Page 1 of 1

Expanding and contracting spheres.

Posted: Tue Oct 14, 2014 9:40 pm
by Berezovsky
I need to create a solid body that is made of three spheres connected by cylindrical links between them. So that they sit together in a line of three balls.

Code: Select all

O-O-O  
I need the ball on the left side to shrink in radius, while the ball in the righthand side grows slowly in radius. Physics should be going on continuously during this smooth transformation, and the links and hinges should remain intact. Is there any simple way of doing this in bullet physics?

I ask because it seems like the creation of a rigid body is a 1-time affair. Attempts to remove and re-create rigid bodies while the physics is updated almost always crashes my program. Thanks.

Re: Expanding and contracting spheres.

Posted: Wed Oct 15, 2014 6:18 am
by Basroil
You can resize the balls by changing the collision shape, but it's not going to be fun between collision caches to worry about, constant recalculation of inertia (even if it's just simple multiplication) and the strange physics you WILL encounter doing that (especially collision/restitution).

There's not much anyone can do to help if you don't state why you want to do that, since there might be other ways to solve your issue that don't involve unsupported uses

Re: Expanding and contracting spheres.

Posted: Wed Oct 15, 2014 10:15 pm
by Berezovsky
Basroil wrote:There's not much anyone can do to help if you don't state why you want to do that, since there might be other ways to solve your issue that don't involve unsupported uses
Sure thing. I'm going to have animals eating things in the environment.

However, I want the total volume of V=(animals+food) to remain constant over time. That's all.

Re: Expanding and contracting spheres.

Posted: Fri Oct 17, 2014 8:05 am
by Basroil
Berezovsky wrote:Sure thing. I'm going to have animals eating things in the environment.

However, I want the total volume of V=(animals+food) to remain constant over time. That's all.
I assume you mean a group-wise relationship of volume between a piece of food and all animals eating it right? (rather than food a mile away magically shrinking) If that's the case, you don't need to update the volume every frame, just those frames where a new animal comes inside an existing group but is not feeding (on something, assuming you have predators), that is in contact. For all other frames just scale your graphics models accordingly. After all, your overall volume delta is zero, so for any objects outside the broadphase collision area the group is equivalent.

Obviously it's not going to be that simple, but I hope it gives you something to start with.