コード例 #1
0
	void SetPhysicsInterface(IPhysicsInterface* obj){
		mPhysicsInterface = obj;
		mSelf->setUserPointer(mSelf); // to avoid dynamic_cast

		// save actor;
		mGamePtr = obj->GetUserPtr();
	}
コード例 #2
0
	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;
	}
コード例 #3
0
	~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());
	}
コード例 #4
0
	//---------------------------------------------------------------------------
	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);
	}