virtual void SubmitConstraints (dFloat timestep, int threadIndex) { dMatrix matrix; dVector com; const dFloat speed = 3.0f; NewtonBody* const body = GetBody0(); NewtonBodyGetCentreOfMass(body, &com[0]); NewtonBodyGetMatrix(body, &matrix[0][0]); com = matrix.TransformVector(com); switch (m_state) { case m_stop: { SetTargetPosit (com); break; } case m_driving: { dVector veloc (m_target - com); veloc = veloc.Scale (speed / dSqrt (veloc % veloc)); dVector target = com + veloc.Scale(timestep); SetTargetPosit (target); break; } default:; dAssert (0); } CustomKinematicController::SubmitConstraints (timestep, threadIndex); }
void CustomKinematicController::SetTargetMatrix(const dMatrix& matrix) { SetTargetRotation (matrix); SetTargetPosit (matrix.m_posit); }
void CustomPickBody::SetTargetMatrix(const dMatrix& matrix) { SetTargetRotation (matrix); SetTargetPosit (matrix.m_posit); }