void SetPhysicsInterface(IPhysicsInterface* obj){
		mPhysicsInterface = obj;
		mSelf->setUserPointer(mSelf); // to avoid dynamic_cast

		// save actor;
		mGamePtr = obj->GetUserPtr();
	}
	void SetPhysicsInterface(IPhysicsInterface* obj, const Vec3I& groupIdx){
		mPhysicsInterface = obj;
		mSelf->setUserPointer(mSelf); // to avoid dynamic_cast

		// save actor;
		mGamePtr = obj->GetUserPtr();

		mGroupIdx = groupIdx;
		mGroupedRigidBody = true;
	}
	~Impl(){
		UnregisterFromWorld();
		mSelf->setUserPointer(0);
		mGamePtr = 0;
		FB_DELETE(mRotationInfo);
		RemoveConstraints();

		auto colShape = mSelf->getCollisionShape();
		if (colShape){
			Physics::GetInstance().Release(colShape);
		}

		if (mWorld){
			mWorld->removeRigidBody(mSelf);
			mAddedToWorld = false;
		}
		FB_DELETE_ALIGNED(mSelf->getMotionState());
	}
	//---------------------------------------------------------------------------
	Impl(RigidBodyImpl* self, btDiscreteDynamicsWorld* world, IPhysicsInterface* colProvider)
		: mSelf(self)
		, mWorld(world)
		, mPhysicsInterface(0)
		, mGamePtr(0)
		, mColProvider(colProvider)
		, mGroupedRigidBody(false)
		, mGroupIdx(Vec3I::MAX)
		, mGameFlag(0)
		, mAddedToWorld(false)
		, mDebug(false)
	{
		auto colShape = mSelf->getCollisionShape();
		if (colShape)
		{
			Physics::GetInstance().AddRef(colShape);
		}
		mRotationInfo = FB_NEW(RotationInfo);
		mSelf->setUserPointer(self);
	}