Movement/Rotation

Hi all,

I have a little pod which can be controlled left/right with the arrow keys but I need the pod to rotate up and move upward on an angle until it reaches 2 on the Y axis and then rotate downward and move down on an angle until it reaches 0 on the y axis - and continue this up/down movement.

The way a whale moves through the water explains it I guess. It can turn left and right but all the time it surfaces and then descends. I’ve been having all kinds of probs getting this to work including issues with the pod tilting and rolling of it’s axis. I need to the pod to stay flat and not tilt at all. The only rotation needs to be to turn left and right and then the upward and downward rotation similar to a whale moving in and out of the water.

function Update () {

	transform.Translate(Vector3.forward*Time.deltaTime*5);

	if (Input.GetAxis("Horizontal")>0){
		transform.Rotate(Vector3.up * Time.deltaTime*50);

	}
	if (Input.GetAxis("Horizontal")<0){
		transform.Rotate(-Vector3.up * Time.deltaTime*50);
	}	
}

Any tips on this would be wonderful thanks.

Cheers

Jeff

Its hard to do a smooth movement with simple functions like - or +, try iTween

http://itween.pixelplacement.com/index.php