|
Hi all, I've been working on a project with joints, and I've hit an issue with configurable joints that I can't wrap my head around. Say I have two objects: Object A
Object B
Basically I'd like Object A to be a physics-controlled object that always rotates to "look at" Object B. I've been attempting this by setting the TargetRotation property of Object A to a Quaternion that looks at Object B. This causes Object A to rotate as Object B moves around the screen, but its rotation is not correct. Object A's rotation does not seem to follow or point at Object B in any useful way. Here are the non-default properties of my joint:
I guess I don't fully understand how the TargetRotation property works. I'm at a loss on how to fix this. Thanks for reading.
(comments are locked)
|
|
I figured it out! Originally I was getting a vector pointing towards the Target from the joint and using Quaternion.LookRotation(). I needed to also invert the Quaternion (using Quaternion.Inverse) before setting it as the joint's TargetRotation. It works great now.
(comments are locked)
|
