- Home /
Rotating Player Controller locally or globally.
So i have been using this program for a few days now, watched a bunch of tutorials and i ran into this problem.
When i go to rotate my char, it will rotate on the wrong axis. I cant seem to figure out how to change this. Im using the code from TornadoTwins. I edited out the movement part as i do not want this to move, but only rotate. Right now im rotating via side view, and i want to rotate via top view, or the global Y axis. Basicly my question is, how can i change this script to use global axis rather than local?
var rotateSpeed = 3; var bullitPrefab: Transform;
function Update () { var controller : CharacterController = GetComponent(CharacterController );
//Rotate
transform.Rotate( 0, Input.GetAxis( "Horizontal" ) * rotateSpeed, 0 );
if(Input.GetButtonDown("Fire1")) {
var bullit = Instantiate(bullitPrefab, GameObject.Find("firepoint1").transform.position , Quaternion.identity);
}
} @script RequireComponent( CharacterController );
Your answer
Follow this Question
Related Questions
use world axis when using transform.rotate 3 Answers
use world axis when using transform.rotate 0 Answers
Is it possible to keep an object upright inside another game object that is spinning or rolling 1 Answer
Move object relative to its axis 2 Answers
Moving an object based on the position of another object 2 Answers