void Activate(){
		mSelf->activate();
	}
	// make sure mColProvider is valid.
	void ReAddRigidBodyFromWorld(){
		mSelf->forceActivationState(ACTIVE_TAG);
	}
	void SetCCDSweptSphereRadius(float radius){
		mSelf->setCcdSweptSphereRadius(radius);
	}
	void SetLinearDamping(float damping){
		float an = mSelf->getAngularDamping();
		mSelf->setDamping(damping, an);
	}
	void SetDamping(float linear, float angular){
		mSelf->setDamping(linear, angular);
	}
	void RemoveCollisionFilter(unsigned flag){
		if (mSelf->getBroadphaseHandle())
			mSelf->getBroadphaseHandle()->m_collisionFilterGroup = mSelf->getBroadphaseHandle()->m_collisionFilterGroup & ~flag;
	}
	void SetColMask(unsigned mask){
		if (mSelf->getBroadphaseHandle())
			mSelf->getBroadphaseHandle()->m_collisionFilterMask = mask;
	}
	Vec3 GetForce(){
		return BulletToFB(mSelf->getTotalForce());
	}
	void ClearForces(){
		mSelf->clearForces();
	}
示例#10
0
	void SetDebug(bool debug){
		mDebug = debug;
		mSelf->btSetDebug(debug);
	}
示例#11
0
	bool CheckCollideWith(RigidBodyPtr other){
		return mSelf->checkCollideWith((RigidBodyImpl*)other.get());
	}
示例#12
0
	void* GetLastConstraintsPtr(){
		auto num = mSelf->getNumConstraintRefs();
		if (num == 0)
			return 0;
		return mSelf->getConstraintRef(num - 1);
	}
示例#13
0
	Vec3 GetPos() const{
		return BulletToFB(mSelf->getWorldTransform().getOrigin());
	}
示例#14
0
	void SetIgnoreCollisionCheck(RigidBodyPtr rigidBody, bool ignore){
		auto colObj = dynamic_cast<btCollisionObject*>(rigidBody.get());
		if (mSelf->checkCollideWithOverride(colObj) == ignore){
			mSelf->setIgnoreCollisionCheck(colObj, ignore);
		}
	}
	void SetMass(float mass){
		btVector3 inertia;
		mSelf->getCollisionShape()->calculateLocalInertia(mass, inertia);
		mSelf->setMassProps(mass, inertia);
	}
	float GetSpeed() const{
		return mSelf->getLinearVelocity().length();
	}
	void SetCollisionFilter(unsigned group){
		if (mSelf->getBroadphaseHandle())
			mSelf->getBroadphaseHandle()->m_collisionFilterGroup = group;
	}
	Vec3 GetVelocity() const{
		return BulletToFB(mSelf->getLinearVelocity());
	}
	void AddCollisionFilter(unsigned flag){
		if (mSelf->getBroadphaseHandle())
			mSelf->getBroadphaseHandle()->m_collisionFilterGroup |= flag;
	}
	Vec3 GetAngularVelocity() const{
		return BulletToFB(mSelf->getAngularVelocity());
	}
	unsigned GetColMask() const{
		if (mSelf->getBroadphaseHandle())
			return mSelf->getBroadphaseHandle()->m_collisionFilterMask;
		else
			return -1;
	}
	void SetAngularVelocity(const Vec3& angVel){
		mSelf->setAngularVelocity(FBToBullet(angVel));
	}
	void SetAngularDamping(float damping){
		float linear = mSelf->getLinearDamping();
		mSelf->setDamping(linear, damping);
	}
	Vec3 GetTorque() const{
		return BulletToFB(mSelf->getTotalTorque());
	}
	void RemoveRigidBodyFromWorld(){
		mSelf->forceActivationState(WANTS_DEACTIVATION);
	}
	void SetVelocity(const Vec3& vel){
		mSelf->setLinearVelocity(FBToBullet(vel));
	}
	void SetCCDMotionThreshold(float threshold){
		mSelf->setCcdMotionThreshold(threshold);
	}
示例#28
0
	void Stop(){
		mSelf->setAngularVelocity(btVector3(0, 0, 0));
		mSelf->setLinearVelocity(btVector3(0, 0, 0));
		mSelf->clearForces();
	}