x


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 );

more ▼

asked Mar 13 '12 at 10:59 PM

Ghrimm gravatar image

Ghrimm
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

0 answers: sort oldest
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2168
x725
x322
x134
x122

asked: Mar 13 '12 at 10:59 PM

Seen: 616 times

Last Updated: Mar 13 '12 at 10:59 PM