- Home /
space moving physics
hello, im making a space shooter game and im in need of help on how to do some moving physics. just so i dont need to explain everything here is a video of the physics im talking about. (moving, tilting when turning) http://www.youtube.com/watch?v=Ul-MiX1Qge0
here is my code i have
var speed = 3.0;
var rotateSpeed = 3.0;
function Update () { var controller : CharacterController = GetComponent(CharacterController);
// Rotate? around y - axis
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)
Answer by Julian-Glenn · Aug 13, 2010 at 11:43 PM
Here's a place to start. *Note it needs some tweaking to get it to work but you'll learn quite a bit through the code:
http://forum.unity3d.com/viewtopic.php?p=277853
There is also a 2d spaceship controller here:
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
LookAt not working, points in wrong direction. 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Quick way to enter and condense repeated lines of code 2 Answers