Set hinge angle

Post Reply
User avatar
Neo
Posts: 10
Joined: Fri Feb 19, 2016 2:04 am

Set hinge angle

Post by Neo »

Hello, is there any way to set hinge constraint angle directly instead of using motortarget function?
I need this for network synchronizing. If I can send a single float variable of hinge angle value rather than position vector + rotation vector of every part of the hinge, it would save a lot of bandwidth. However, I only find getHingeAngle(), there's nothing like setHingeAngle().
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Set hinge angle

Post by Erwin Coumans »

This is only available if you use btMultiBody using revolute joints, which are like hinges. Note that you can mix btMultiBody and btRigidBody in the same dynamics world.

Generally you cannot just set the link state in a btTypeConstraint, since you would need to update the position of both attached btRigidBody: how would you want to to this? Shift both parent and child rigid body, or only the child? Also, this may violate other constraints for those bodies.

Of course you can create your own custom implementation to reset the bodies and hinge so that it matches an angle.
User avatar
Neo
Posts: 10
Joined: Fri Feb 19, 2016 2:04 am

Re: Set hinge angle

Post by Neo »

Thank you for that. Now I know it is current unable to do that so far. Instead of adding the function (I don't have enough time for that right now), I come up with a compromised solution:
1.Only send one of the hinge parts' position and rotation with rotation information only from another object of hinge joint to another computer
2. On the other side calculate the position of another object based on new position received from network
3. Apply new positions and rotations
Post Reply