x


Can I limit the rotation of an Object on an axis between a Negative and Positive value?

Hellow,

As asked in the title, is there a way to limit the rotation of an object between a negative and positive value?

Exemple:

Limit rotation from -90 (270) to 90. Thus making it from 270 to 0 to 90. And not 270 to 0 to 90.

Thank you.

more ▼

asked Oct 17 '10 at 06:43 PM

Oninji gravatar image

Oninji
332 43 47 50

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

2 answers: sort oldest

I control my rotation through a value. Convert the value to eulerangle. This permit to limit between a negative and positive value. It also avoid the gimbleLock problem.

more ▼

answered Oct 21 '10 at 09:11 PM

Oninji gravatar image

Oninji
332 43 47 50

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

You can use a hinge joint limit or you can use Vector3.angle

For hinge joint you can set a min angle of -90 and a max angle of 90 but it's physics based so wont work for scripted movement.

Finding the angle between a standard direction and the current direction via scripts and stopping its movement or snapping to the limit is the other option.

more ▼

answered Oct 17 '10 at 09:33 PM

spinaljack gravatar image

spinaljack
9.1k 18 31 91

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

x5081
x2167
x2087
x322

asked: Oct 17 '10 at 06:43 PM

Seen: 2093 times

Last Updated: Oct 17 '10 at 06:43 PM