void StaticPhysicsObject::syncInactiveImplementationObject(PHYSICS_ACTOR &obj)
	{
		if (moveToPosition)
		{
			obj->setPosition(position);
			moveToPosition = false;
		}

		if (moveToRotation)
		{
			obj->setRotation(rotation);
			moveToRotation = false;
		}

		this->dirty = false;
	}
	void AbstractPhysicsObject::syncInactiveImplementationObject(PHYSICS_ACTOR &obj)
	{
		if(!dynamicActor)
			return;

		if (moveToVelocity)
		{
			obj->setVelocity(velocity);
			moveToVelocity = false;
		}

		if (moveToAngularVelocity)
		{
			obj->setAngularVelocity(angularVelocity);
			moveToAngularVelocity = false;
		}

		if (doImpulse)
		{
			obj->addImpulse(impulsePosition, impulse);
			impulsePosition = VC3(0,0,0);
			impulse = VC3(0,0,0);
			doImpulse = false;
		}

		if (moveToPosition)
		{
			if (attemptedPosition)
			{
				obj->movePosition(position);
				attemptedPosition = false;
			} else {
				obj->setPosition(position);
			}
			moveToPosition = false;
		}

		if (moveToRotation)
		{
			if (attemptedRotation)
			{
				obj->moveRotation(rotation);
				attemptedRotation = false;
			} else {
				obj->setRotation(rotation);
			}
			moveToRotation = false;
		}

		this->dirty = false;
	}
	void AbstractPhysicsObject::syncImplementationObject(PHYSICS_ACTOR &obj)
	{
		if(!dynamicActor)
			return;

		if (this->toSleep)
		{
			this->toSleep = false;
			obj->putToSleep();
		}

		VC3 prevVel = velocity;
		VC3 prevAngVel = angularVelocity;

		if (this->enableYMovementSet)
		{
			this->enableYMovementSet = false;
#ifdef PHYSICS_PHYSX
			obj->enableFeature(frozenbyte::physics::ActorBase::FREEZE_POSITION_Y, false);
#endif
#ifdef PHYSICS_ODE

#pragma message("FIXME: enableYMovement")
//			obj->enableYMovement();
#endif
		}

		if (moveToVelocity)
		{
			obj->setVelocity(velocity);
			moveToVelocity = false;
		} else {
			obj->getVelocity(velocity);
		}

		if (moveToAngularVelocity)
		{
			obj->setAngularVelocity(angularVelocity);
			moveToAngularVelocity = false;
		} else {
			obj->getAngularVelocity(angularVelocity);
		}

		if (doImpulse)
		{
			obj->addImpulse(impulsePosition, impulse);
			impulsePosition = VC3(0,0,0);
			impulse = VC3(0,0,0);
			doImpulse = false;
		}

		if (moveToPosition)
		{
			if (attemptedPosition)
			{
				obj->movePosition(position);
				attemptedPosition = false;
			} else {
				obj->setPosition(position);
			}
			moveToPosition = false;
		} else {
			obj->getPosition(position);
		}

		if (moveToRotation)
		{
			if (attemptedRotation)
			{
				obj->moveRotation(rotation);
				attemptedRotation = false;
			} else {
				obj->setRotation(rotation);
			}
			moveToRotation = false;
		} else {
			obj->getRotation(rotation);
		}

		obj->getMassCenterPosition(massCenterPosition);

		if (this->disableAngularVelocitySet)
		{
			this->disableAngularVelocitySet = false;
#ifdef PHYSICS_PHYSX
			obj->enableFeature(frozenbyte::physics::ActorBase::FREEZE_ROTATION_X, true);
			obj->enableFeature(frozenbyte::physics::ActorBase::FREEZE_ROTATION_Y, true);
			obj->enableFeature(frozenbyte::physics::ActorBase::FREEZE_ROTATION_Z, true);
#endif
#ifdef PHYSICS_ODE
			obj->disableAngularVelocity();
#endif
		}

		if (this->disableYMovementSet)
		{
			this->disableYMovementSet = false;
#ifdef PHYSICS_PHYSX
			obj->enableFeature(frozenbyte::physics::ActorBase::FREEZE_POSITION_Y, true);
#endif
#ifdef PHYSICS_ODE

#pragma message("FIXME: disableYMovement")
//			obj->disableYMovement();
#endif
		}

#ifdef PHYSICS_FEEDBACK
#ifdef PHYSICS_ODE
		obj->getFeedbackNormal(this->feedbackNormal);
		obj->getFeedbackNormalLeft(this->feedbackNormalLeft);
		obj->getFeedbackNormalRight(this->feedbackNormalRight);
#endif
#endif

		// FIXME: should calculate this in correct measures... m/s^2 maybe...
		// now, it's based on the frequency of the syncImplementationObject calls...
		// (m/tick^2?)
		this->acceleration = velocity - prevVel;
		this->angularAcceleration = angularVelocity - prevAngVel;

		this->previousVelocity = prevVel;
		this->previousAngularVelocity = prevAngVel;

		this->dirty = false;
	}