It is currently Wed Feb 21, 2018 3:39 pm

Reply to topic  [ 4 posts ] 
Request -Constraint Rotation Limits 
Author Message

Joined: Sat Jan 09, 2016 10:15 am
Posts: 2
Hey there, great stuff! I really dig your tools.
I was wondering if you guys could put into UnityConstraints actual constraints on look at rotations?
Currently it seems that the object doing the looking will rotate however far it needs to in order to keep looking at the object.
In my game, I need a limited range of rotation on a turret and it would be great if UnityConstraints had local rotation limit fields built in.

Thanks and keep up the great work!

Sat Jan 09, 2016 10:23 am

Joined: Sat Jan 09, 2016 10:15 am
Posts: 2
chirp...chirp......chirp...chirp :roll:

Tue Feb 09, 2016 3:31 pm
Site Admin

Joined: Sun Apr 17, 2011 12:30 pm
Posts: 885

I think this would be pretty easy to do by adding angle-limiting to UnityConstraints.cs MaskOutputRotations() method. This method is used by the smooth lookat constraint to output the result on the specific local axes. This wouldn't stop it from flipping if the target went behind the object and crossed the 180-degree-line of course. It may also get tricky if using more than 1 axis at a time (which is something that method doesn't support since it is expected that you would use a second constraint for a second axis I believe). This would probably need to be a new type of constraint (new component).

So some parts are trivial and some aren't. I don't know if we would add this at this time as we have a lot on our plate, but it is an interesting idea that would be worth doing.

By the way, we actually have this behavior working in TriggerEventPRO which handles more complex look-at situations and target tracking. It works around UnityConstraints by manipulating the target though (remove if out of angle range and include if in angle range). Just another possibility.

Thu Feb 18, 2016 8:22 pm
Site Admin

Joined: Sun Apr 17, 2011 12:30 pm
Posts: 885
I just realized I didn't offer any workaround. You can do a rigging trick and make the GameObject with the look-at constraint a sibling of the actual head rotation parent then make a simple script that uses the constraint-object's local rotations while within a range. In other words, use the constraint as a reference only and just ignore it when you are out of a given range.

Sat Feb 20, 2016 3:08 pm
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.