x


set the rotation to zero

Hi guys

I am working on creating a tank game & have this little problem im stuck with so here it goes

I have a gun mounted on the tank which i can rotate in any direction i want, wat i want to do is after i have rotated it in any direction the rotation of the gun should remain and the pivot should again get reset to the local axis i think Smile that is after i have rotated it once the pivot also gets rotated in the same direction i want to get reset just like freeze transformation in "Maya".

thankyou

more ▼

asked Jun 17 '10 at 10:28 AM

raviraj gravatar image

raviraj
1 1 1 1

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

1 answer: sort voted first

Something like this should work:

from the gun script (in js):

var rot = transform.rotation;
transform.parent.rotation = Quaternion.identity;
transform.rotation = rot;
more ▼

answered Jun 17 '10 at 10:36 AM

Mike 3 gravatar image

Mike 3
30.7k 10 67 256

(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:

x133
x89

asked: Jun 17 '10 at 10:28 AM

Seen: 2273 times

Last Updated: Jun 17 '10 at 10:28 AM