x


velocity direction

In my game, there is a ball that gets a velocity in the beginning, like this:

var velocity : float = 15;
function Start () {
    rigidbody.velocity = new Vector3(velocity, 0, 0,); 
}

Now the problem is, if I rotate the ball, it keeps on going along the global x axis (Even if I rotate the ball before the game starts, it just follows global x.). How can I make the ball follow its local x axis?

Thanks

Arne

more ▼

asked Sep 21 '11 at 03:22 PM

arnegevaert gravatar image

arnegevaert
1 4 4 6

instead of new Vector3 do transform.forward * velocity

Jan 08 at 03:23 AM Josh707
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
more ▼

answered Sep 21 '11 at 03:27 PM

kevork gravatar image

kevork
415 1 2 4

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x1793
x724
x318
x286
x134

asked: Sep 21 '11 at 03:22 PM

Seen: 1212 times

Last Updated: Jan 08 at 03:23 AM