void PhyFixed::createPrivateJoint() { #ifdef WORLDSIM_USE_NEWTON m_priv->joint = NewtonConstraintCreateUserJoint( m_worldPriv->world, 6, PhyJointPrivate::userBilateralHandler, 0, m_priv->child, m_priv->parent ); NewtonJointSetUserData( m_priv->joint, this ); #endif }
NewtonCustomJoint::NewtonCustomJoint (int maxDOF, NewtonBody* body0, NewtonBody* body1) { m_joint = NULL; m_body0 = body0; m_body1 = body1; m_maxDox = maxDOF; m_world = NewtonBodyGetWorld (body0); m_joint = NewtonConstraintCreateUserJoint (m_world, maxDOF, SubmitConstrainst, m_body0, m_body1); NewtonJointSetUserData (m_joint, this); NewtonJointSetDestructor (m_joint, Destructor); }
void CustomJoint::Init (int maxDOF, NewtonBody* const body0, NewtonBody* const body1) { m_autoDestroy = 0; m_joint = NULL; m_body0 = body0; m_body1 = body1; m_maxDof = maxDOF; m_world = NewtonBodyGetWorld (body0); m_joint = NewtonConstraintCreateUserJoint (m_world, maxDOF, SubmitConstraints, GetInfo, m_body0, m_body1); NewtonJointSetUserData (m_joint, this); NewtonJointSetDestructor (m_joint, Destructor); m_userData = NULL; m_userDestructor = NULL; m_userConstrationCallback = NULL; }
void dCustomJoint::Init (int maxDOF, NewtonBody* const body0, NewtonBody* const body1) { m_joint = NULL; m_body0 = body0; m_body1 = body1; m_maxDof = maxDOF; m_autoDestroy = 0; m_stiffness = 1.0f; m_world = body0 ? NewtonBodyGetWorld (body0) : NewtonBodyGetWorld (body1); m_joint = NewtonConstraintCreateUserJoint (m_world, maxDOF, SubmitConstraints, m_body0, m_body1); NewtonJointSetUserData (m_joint, this); NewtonJointSetDestructor (m_joint, Destructor); m_userData = NULL; m_userDestructor = NULL; }
iPhysicsJoint* iPhysics::createJoint(iPhysicsBody* body0, iPhysicsBody* body1, int dof) { iPhysicsJoint* result = nullptr; con_assert(body0 != nullptr, "zero pointer"); if (body0 != nullptr) { NewtonWaitForUpdateToFinish(static_cast<const NewtonWorld*>(_defaultWorld)); NewtonJoint * joint = NewtonConstraintCreateUserJoint(static_cast<NewtonWorld*>(_defaultWorld), dof, reinterpret_cast<NewtonUserBilateralCallback>(SubmitConstraints), nullptr, static_cast<NewtonBody*>(body0->getNewtonBody()), body1 != nullptr ? static_cast<NewtonBody*>(body1->getNewtonBody()) : nullptr); result = new iPhysicsJoint(joint, body0->getID(), body1 != nullptr ? body1->getID() : 0); _jointListMutex.lock(); _joints[result->getID()] = result; _jointListMutex.unlock(); NewtonJointSetUserData(joint, result); } return result; }