Im trying to build a particle emitter using bullet but I bumped into a few problems.
1) Every particle (rigid body) has a life. When it dies I want to deactivate it so it cannot be part of any collision/simulation calculations. Whats the best way to do that? Obviously the btRigidBody::setActivationState is not for that job.
2) If I want to make smoke that goes up what should I do? If I set the gravity manually (btRigidBody::setGravity) in the body nothing happens.
A little help with building a particle emitter
-
- Posts: 20
- Joined: Fri Feb 19, 2010 7:09 pm
-
- Posts: 20
- Joined: Fri Feb 19, 2010 7:09 pm
Re: A little help with building a particle emitter
Anyone? I promise I will write an article in the wiki in the end
-
- Posts: 6
- Joined: Fri Oct 16, 2009 12:20 pm
Re: A little help with building a particle emitter
Well, setGravity per object is working beautifully for me. I have a global -7.5 gravity, so most objects fall down, but some objects I set a positive gravity so they kind of float.
You need to check why setGravity isn't working.
You need to check why setGravity isn't working.
-
- Posts: 20
- Joined: Fri Feb 19, 2010 7:09 pm
Re: A little help with building a particle emitter
Great thanks. It looks like I was doing something wrong with the gravity. The first question remains though. How can deactivate a body?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: A little help with building a particle emitter
There is not really a good mechanism for this.
You could try to remove the particle/body from the world, or is that too slow?
Otherwise, try using
to disable the particle, and to enable again:
Thanks,
Erwin
You could try to remove the particle/body from the world, or is that too slow?
Otherwise, try using
Code: Select all
object->forceActivationState(DISABLE_SIMULATION);
Code: Select all
object->forceActivationState(ACTIVE_TAG);
Erwin
-
- Posts: 20
- Joined: Fri Feb 19, 2010 7:09 pm
Re: A little help with building a particle emitter
Thanks for the reply!Erwin Coumans wrote:There is not really a good mechanism for this.
You could try to remove the particle/body from the world, or is that too slow?
Otherwise, try usingto disable the particle, and to enable again:Code: Select all
object->forceActivationState(DISABLE_SIMULATION);
Thanks,Code: Select all
object->forceActivationState(ACTIVE_TAG);
Erwin
Generally I avoid mem allocations inside the main loop and by removing and adding in a btAlignedObjectArray the loop may become considerably slow (in some cases). I will try changing the activation state but its a nice thought to have such a feature (maybe in a future release?).
Without trying to be judgmental here is a thought on improving the API. You can put the activation states in an enum and change the type of the arguments on forceActivationState and setActivationState from int to that enum. With this way we can know what are the acceptable argument values in forceActivationState and setActivationState.