Help with btMultiSphereShape

Post Reply
mrev1l1
Posts: 3
Joined: Fri Jul 24, 2015 10:07 am

Help with btMultiSphereShape

Post by mrev1l1 »

Hi everyone!
I'm new to bullet physics. Basically i just started exploring it.
Right now i'm trying to create some kind of an Egg Shape. As i understood, btMultiSphereShape would work fine for this purpose. But the problem is, i don't get, how do i create btMultiSphereShape object and make it contain a few spheres of different radius? just a small explanation with a tiny code snippet would be perfect!
Thanks!
mrev1l1
Posts: 3
Joined: Fri Jul 24, 2015 10:07 am

Re: Help with btMultiSphereShape

Post by mrev1l1 »

Ok. i guess, i got it.
correct me, if i'm wrong, but basically, i should do smth like this:

Code: Select all

btVector3* SubSpheres = new btVector3[3];
	SubSpheres[0] = btVector3(0, 0, 0);
	SubSpheres[1] = btVector3(0, 0.75, 0);
	SubSpheres[2] = btVector3(0, 1, 0);

	btScalar* PartsRadiuses = new btScalar[3];
	PartsRadiuses[0] = btScalar(1.0f);
	PartsRadiuses[1] = btScalar(.75f);
	PartsRadiuses[2] = btScalar(.5f);

	btMultiSphereShape* eggAmmoShape = new btMultiSphereShape(SubSpheres, PartsRadiuses, 3);
so i'm saying, that there are 3 subspheres, each one penetrates the one below.
Post Reply