x


Rotate and Move towards Mouse Point

I am trying to apply forward movement and rotation, however I can not get the two to mix. So far, only rotation works the way it should. Forward movement, under a Character Controller .move, ignores the rotation and keeps going straight.

My code so far stands as:

transform.LookAt(posistion);
transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y, 0));

Vector3 mover = new Vector3(0,0,3);

mover = mover * Time.deltaTime * 4;

controller.Move(mover); 

Posistion represents the actual mouse, and I'm rotating along the Y axis for a top-down game. The mouse controls where the player goes, although not by clicking.

more ▼

asked May 08 '12 at 07:55 PM

Teonnyn gravatar image

Teonnyn
78 7 13 23

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

0 answers: sort voted first
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:

x2155
x982
x322
x43
x9

asked: May 08 '12 at 07:55 PM

Seen: 530 times

Last Updated: May 08 '12 at 07:55 PM