Moderators: Sascha Willems, Thomas
void NewtonUserJoint::AddAngularRowJacobian (const dgVector& dir, dgFloat32 relAngle)
{
CalculateAngularDerivative (m_rows, *m_param, dir, m_stiffness, relAngle, &m_forceArray[m_rows]);
m_rows ++;
dgAssert (m_rows <= dgInt32 (m_maxDOF));
}
const dFloat angularFritionAccel = 100.0f;
const dFloat linearFrictionAccel = 100.0f * dAbs (dMax (DEMO_GRAVITY, 10.0f));
const dFloat inertia = dMax (Izz, dMax (Ixx, Iyy));
//m_pickJoint = new dCustomKinematicController (body, posit);
m_pickJoint = new DemoCameraPickBodyJoint (body, posit, this);
m_pickJoint->SetPickMode (0);
m_pickJoint->SetMaxLinearFriction(mass * linearFrictionAccel);
m_pickJoint->SetMaxAngularFriction(inertia * angularFritionAccel);
dFloat angle = 2.0f * dAcos(dClamp(rotation.m_w, dFloat(-1.0f), dFloat(1.0f)));
NewtonUserJointAddAngularRow (m_joint, angle, &rot.m_front[0]);
NewtonUserJointSetRowMinimumFriction (m_joint, -m_maxAngularFriction);
NewtonUserJointSetRowMaximumFriction (m_joint, m_maxAngularFriction);
dFloat angle = 2.0f * dAcos(dClamp(rotation.m_w, dFloat(-1.0f), dFloat(1.0f)));
dFloat speed = omega.DotProduct3(rot[0]);
dFloat relSpeed = angle * invTimestep - speed;
dFloat relAccel = relSpeed * invTimestep;
NewtonUserJointAddAngularRow (m_joint, angle, &rot.m_front[0]);
NewtonUserJointSetRowAcceleration(m_joint, relAccel);
NewtonUserJointSetRowMinimumFriction (m_joint, -m_maxAngularFriction);
NewtonUserJointSetRowMaximumFriction (m_joint, m_maxAngularFriction);
../applications\demosSandbox\sdkDemos\DemoCameraManager.cpp
// change this to make the grab stronger or weaker
const dFloat gfactor = 100.0f;
const dFloat angularFritionAccel = gfactor;
const dFloat linearFrictionAccel = gfactor * dAbs (dMax (DEMO_GRAVITY, 10.0f));
const dFloat inertia = dMax (Izz, dMax (Ixx, Iyy));
//m_pickJoint = new dCustomKinematicController (body, posit);
m_pickJoint = new DemoCameraPickBodyJoint (body, posit, this);
m_pickJoint->SetPickMode (0);
m_pickJoint->SetMaxLinearFriction(mass * linearFrictionAccel);
m_pickJoint->SetMaxAngularFriction(inertia * angularFritionAccel);
Users browsing this forum: No registered users and 1 guest