[SOLVED]Beginner Q re parameters to setMotorTarget()
Posted: Wed Dec 14, 2016 5:34 am
Apologies if I'm missing something obvious - learning the relevant math along with the library and that leads
to some embarrassing confusion sometimes:
I'm using setMotorTarget() to manipulate some hinge joints and in a desire to better understand what's going
on under the hood I was looking at its source and am confused about something. Ultimately, what it seems to
do is set the angular velocity for the hinge. But what throws me is that it sets the velocity to the total distance
required per time step.
Here is the relevant code from void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt):
btScalar curAngle = getHingeAngle(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
btScalar dAngle = targetAngle - curAngle;
m_motorTargetVelocity = dAngle / dt;
dt = delta Time since last step (at least that's what the examples I have found pass in)
My question is: if the motor's velocity is getting set to the total distance per delta time then why isn't the motor just instantly jumping to the target angle? I tried to follow m_motorTargetVelocity
to see where it was being used but ended up in the weeds and thought I'd try asking before I go back in there.
to some embarrassing confusion sometimes:
I'm using setMotorTarget() to manipulate some hinge joints and in a desire to better understand what's going
on under the hood I was looking at its source and am confused about something. Ultimately, what it seems to
do is set the angular velocity for the hinge. But what throws me is that it sets the velocity to the total distance
required per time step.
Here is the relevant code from void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt):
btScalar curAngle = getHingeAngle(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
btScalar dAngle = targetAngle - curAngle;
m_motorTargetVelocity = dAngle / dt;
dt = delta Time since last step (at least that's what the examples I have found pass in)
My question is: if the motor's velocity is getting set to the total distance per delta time then why isn't the motor just instantly jumping to the target angle? I tried to follow m_motorTargetVelocity
to see where it was being used but ended up in the weeds and thought I'd try asking before I go back in there.