Generic6DofConstraint z-axis Rotational Motor don't work.

sajjjjad
Posts: 5
Joined: Mon Sep 17, 2012 8:09 am

Generic6DofConstraint z-axis Rotational Motor don't work.

Post by sajjjjad »

I have created a simple model (two boxes and a Generic6DofConstraint joint between them) in blender, and import it to bullet.
I want to set motor for this model in bullet, I wrote this simple code:

\\btGeneric6DofConstraint* g;
\\g=(btGeneric6DofConstraint *)m_dynamicsWorld->getConstraint(0);
\\g->getRotationalLimitMotor(0)->m_enableMotor=true;
\\g->getRotationalLimitMotor(0)->m_maxMotorForce=10;
\\g->getRotationalLimitMotor(0)->m_targetVelocity=5;

\\g=(btGeneric6DofConstraint *)m_dynamicsWorld->getConstraint(0);
\\g->getRotationalLimitMotor(1)->m_enableMotor=true;
\\g->getRotationalLimitMotor(1)->m_maxMotorForce=10;
\\g->getRotationalLimitMotor(1)->m_targetVelocity=5;

g=(btGeneric6DofConstraint *)m_dynamicsWorld->getConstraint(0);
g->getRotationalLimitMotor(2)->m_enableMotor=true;
g->getRotationalLimitMotor(2)->m_maxMotorForce=10;
g->getRotationalLimitMotor(2)->m_targetVelocity=5;

X-axis motor and y-axis motor work Well, but the z-axis motor does not work.
Does anybody have an idea where is the problem? from my blender model, or my code?

I'm very confused to using RotationalMotor even for this simple model.
In future I want to create a complex model (a Humanoid model)in blender and set it's motor controller in bullet. Is Generic6DofConstraint suitable for this work?

Thanks
info128
Posts: 7
Joined: Thu Mar 03, 2011 2:30 am

Re: Generic6DofConstraint z-axis Rotational Motor don't work

Post by info128 »

What values are you specifying when calling setAngularLowerLimit()? I ran into a problem using btGeneric6DofConstraint when attempting to make constraint-controlled ragdoll, later realizing that the 6DOF constraint is limited to a hemisphere of motion. The Y-axis only allows +/-90 degrees of rotation. You mentioned that the Z axis is the problem, so this may not affect you, but it is something to keep in mind.

Here is the post 6DOF Constraint: Y-axis angular limit > 90 degrees?
sajjjjad
Posts: 5
Joined: Mon Sep 17, 2012 8:09 am

Re: Generic6DofConstraint z-axis Rotational Motor don't work

Post by sajjjjad »

thank you for your reply, i have read this post before.
but my problem is in z-axis.
i set limits in blender, i dont call setAngularLowerLimit()
is any problem if i added two joins whit different axis between two bodeis?
in this way i can use x and y axis motor from one joint and a motor from another joint.