- Home /
ConfigurableJoint Target Position/Rotation Problems?
Hi all,
I'm working on a VR game using tracked motion controllers. I'd like to have a baton object be aligned to my controller using Rigidbody forces so that you can wave the baton around as if you're holding it, but have it interact with other physics objects and not just pass right through them.
Reading about ConfigurableJoint, I saw that using target position/rotation parameters, I should be able to align the object (or the joint?) to my controller using forces, which sounds perfect! For the life of me, I can't figure out how to do it though. If I set the target position/rotation to the world space values for my controller, the baton just flies around almost at random. I've tried fiddling with the anchor values, as well as toggling between "Configured in world space" on and off, no luck.
Can anybody please explain how I can use a ConfigurableJoint to apply forces to an object so that it remains oriented with another object?
Answer by Adam-Mechtley · Nov 25, 2016 at 10:56 AM
Hi @rrkpp! There are a lot of different ways you can solve this problem, and unfortunately ConfigurableJoints are quite complex (I will add it to my backlog to improve the documentation).
That said, depending on the needs of your game, you could add a Rigidbody to your batons and either try:
Make the baton Rigidbodies kinematic. They will follow your input exactly, but will hit physical objects with very large force values and effectively disregard the mass of your batons.
Put a kinematic Rigidbody on whatever objects represent your input positions. Then attached the batons to these using a FixedJoint. The batons might jitter if the player hits a really heavy object and they get stuck, but impulse values from collision will be more accurate given the masses of the bodies.
I'm guessing option 1 is the better solution, but you can make the call for your game :)
Your answer
Follow this Question
Related Questions
Configurable Joints pass through colliders 2 Answers
Hinge Joint Giving Fake 'Slack' 0 Answers
Multiple Cars not working 1 Answer
How to use an axis of a eulerAngle for a targetAngle on a HingeJoint? [C#] 0 Answers
Distribute terrain in zones 3 Answers