void RigidBody::postUnserialization() { Link *link = entity.getLinkPtr(); if (isKinematic()) { auto p = posFromMat4(link->getGlobalTransform()); setPosition(posFromMat4(link->getGlobalTransform())); setRotation(link->getOrientation()); } }
void RigidBody::_copyFrom(const ComponentBase *model) { init(); auto m = (RigidBody*)model; #ifdef EDITOR_ENABLED editorUpdate(); if (editorStruct) { editorStruct->copyDatas(m); editorStruct->refreshDatas(this); Link *link = entity.getLinkPtr(); if (isKinematic()) { auto p = posFromMat4(link->getGlobalTransform()); setPosition(posFromMat4(link->getGlobalTransform())); setRotation(link->getOrientation()); // global orientation not supported } } #else setAngularDrag(m->getAngularDrag()); setAngularVelocity(m->getAngularVelocity()); setCenterOfMass(m->getCenterOfMass()); setLinearDrag(m->getLinearDrag()); setLinearVelocity(m->getLinearVelocity()); setMass(m->getMass()); setDiagonalInertiaTensor(m->getDiagonalInertiaTensor()); setMaxAngularVelocity(m->getMaxAngularVelocity()); setMaxDepenetrationVelocity(m->getMaxDepenetrationVelocity()); affectByGravity(m->isAffectedByGravity()); setPosition(m->getPosition()); setRotation(m->getRotation()); setAsKinematic(m->isKinematic()); setCollisionDetectionMode(m->getCollisionDetectionMode()); #endif }
//============================================================================== bool Joint::isDynamic() const { return !isKinematic(); }