Esempio n. 1
0
	void RigidBody::postUnserialization()
	{
		Link *link = entity.getLinkPtr();
		if (isKinematic())
		{
			auto p = posFromMat4(link->getGlobalTransform());
			setPosition(posFromMat4(link->getGlobalTransform()));
			setRotation(link->getOrientation());
		}
	}
Esempio n. 2
0
	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
	}
Esempio n. 3
0
//==============================================================================
bool Joint::isDynamic() const
{
  return !isKinematic();
}