Hi,
I have a game where you are in a sub-sea environment, and fly about in a ship.
Im controling the ship via an xbox 360 controller, using this..
var moveSpeed:float = 1.0;
var turnSpeed:float = 1.0;
var climbSpeed:float = 0.2;
var bouancy:float = 1.0;
function Update ()
{
var DepthControl = Input.GetAxis("Depth");
var horizontalSpeed = Input.GetAxis("Horizontal");
var verticalSpeed = Input.GetAxis("Vertical");
transform.position += transform.forward * verticalSpeed * moveSpeed * Time.deltaTime;
transform.position += transform.right * horizontalSpeed *moveSpeed * Time.deltaTime;
transform.position += transform.up * DepthControl * climbSpeed * Time.deltaTime;
transform.position -= transform.up * bouancy * Time.deltaTime;
}
And i have the other analogue stick controlled by the 'mouse look' standard script attached to the object. As well as the triggers on the back for climbing and decending.
It all looks fairly well so far, but im stuck with how to get the object to tilt when it slides side to side using my 'horizontalSpeed' axis.
i have tried adding
transform.Rotate(Vector3.right, Time.deltaTime);
to it, and other variations, but nothing seems to make it rotate.
Is there some easier way of doing this? - or have i just failed to understand something.
Could the mouse look be canceling out my rotation values?
Any advice would be appreciated, thanks!
- Graeme.