Two rigidbody initialised the same way only one move

Post Reply
Granyte
Posts: 77
Joined: Tue Dec 27, 2011 11:51 am

Two rigidbody initialised the same way only one move

Post by Granyte »

I have an issue where i'm creating several rigidbody and I add them to a world most of them will work fine but randomly some of them won't seem to accumulate any velocity they just stick there and do nothing they at most sidestep other rigidbody when they are penetrating but that's about it once they are no longer penetrating they will just stop moving

i'm buiding on visual studio 2013

double presicion on x64

any one has an idea?


world creation code

Code: Select all

BroadPhase = new btDbvtBroadphase(); //bt32BitAxisSweep3(btVector3(-99999, -99999, -99999), btVector3(99999, 99999, 99999),MAX_PROXIES);//
		btDefaultCollisionConstructionInfo cci = btDefaultCollisionConstructionInfo();
		CollisionConfiguration = new btDefaultCollisionConfiguration(cci);
		//CollisionConfiguration->m_defaultMaxCollisionAlgorithmPoolSize
		Dispatcher = new btCollisionDispatcher(CollisionConfiguration);
		Solver = new btSequentialImpulseConstraintSolver();
		World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver, CollisionConfiguration);

rigid body creation code

Code: Select all

btCollisionShape* pShape;
	pShape = new btSphereShape(0.5);
	

	btTransform Transform;
	Transform.setIdentity();
	Transform.setOrigin(Position + Hull->getCenterOfMassPosition());

	// Give it a default MotionState
	btDefaultMotionState *MotionState = new btDefaultMotionState(Transform);

	// Create the shape

	// Add mass
	btVector3 LocalInertia;
	pShape->calculateLocalInertia(0.2f, LocalInertia);

	// Create the rigid body object
	myRigidBody = new btRigidBody(0.2f, MotionState, pShape, LocalInertia);

	
	// Store a pointer to the irrlicht node so we can update it later
	myRigidBody->setUserPointer((void *)this);
        World->addCollisionObject(Object);

Granyte
Posts: 77
Joined: Tue Dec 27, 2011 11:51 am

Re: Two rigidbody initialised the same way only one move

Post by Granyte »

I found it the rigid body added by world->add collision object glitches out
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Two rigidbody initialised the same way only one move

Post by xexuxjy »

you might want to use collisionWorld->addRigidBody for your object.
Granyte
Posts: 77
Joined: Tue Dec 27, 2011 11:51 am

Re: Two rigidbody initialised the same way only one move

Post by Granyte »

yes I found it out I mixed up the method I use to add other object with the one I use for rigidbody when refactoring one of the class I use to manage bullet
Post Reply