Thursday, 14 July 2011
Developer Journal 113 - On Bullet Physics Constraints
When I was working with hinge constraints I came a cross a problem. A hinge constraint is like a door hinge, rotation can only occur in one axis. The problem was that I could not get the rotation to occur slowly. One of the ways to specify rotation was to specify the desired velocity but at low velocities the hinge constraint would not move. The other way to specify rotation is to specify the desired angle. I tried adding a small number to the desired angle but the constraint still would not move. The trick I found was to have a variable that I slowly incremented over time and use that as the desired angle.
I'm worried that the Generic 6 Degrees of Freedom Constraint does not have a set target angle. That means I may have to find another way to bend and twist limbs slowly. Hopefully the 6 degrees of freedom constraint works differently to the hinge constraint so I don't have to use the target angles to make constraints bend slowly. I can always slowly adjust the upper and lower limits as a last resort.
I don't quite get what the limits do in the 6 degrees of freedom constraint. Are the limits for just the motors or the constraint as well? I can test by doing a twist and locking the other axes. The limits affect how far a limb can bend. Motors can only bend the limb within these limits.
The 6 degrees of freedom constraints can rotate in 3 axis and can slide in 3 axis. This means I can create essentially a muscle that that can shrink and stretch. I look forward to go from having motors in joints to having muscles actuate the limbs.
Note to self, try changing the rag doll constraints to generic 6 degrees of freedom constraints.
Does the twist affect up, down, forward, back? Nope.
Might have to do with 2 generic 6 degrees of freedom constraints instead of just 1.
An idea came to me as I was driving that I could use soft body physics for things like feet and fingers. When you pick up a glass your finger tips mould around the shape. The same happens with your feet.
I was also listening to a talk that discussed the idea that we are building earth's brain and central nervous system. It's an interesting idea.
Shifting the rigid bodies up so that one block is attached to another block that is fixed in the air. Activating the yaw. Worked.
Cool, I can make one of the rigid bodies have infinite mass and the constraint still works. This allows me to have the rigid bodies in the air and do my tests.
Locking the pitch and activating the yaw. Worked.
Locking the pitch and yaw and activating the roll. Worked.
Changing right shoulder joint from a cone twist constraint to a generic six degrees of freedom constraint.
Hmm, I'll also have to add simple hands and feet later.
To do
+ Figure out aesthetic gap between shapes
+ Figure out how to revert back to capsules. I changed from capsules to blocks to help simplify the process of switching the rag doll to 6 degrees of freedom constraints.
RELATED
Labels:
developer journal
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment