- Home /
Particle System inherit velocity from parent
I have a ship object which has four cannon child objects, with one particle system-only object as the child of each cannon. The ship is the only object with a rigidbody in the setup. When the ship is moving forward and the cannon fires to the side, the "cannonball" particle emitted appears to fall behind the ship, when in reality, the particle should appear to move directly away from the ship. The particle has only "start speed" to move it, how would I have the particle inherit velocity from the parent ship object to simulate more realistic physics? Any thoughts on this are greatly appreciated. Thanks!
Answer by mikaelK · Oct 01, 2016 at 04:24 PM
@Shroooook If I understood correctly I'm currently thinking about the same thing and googling if there is a better solution available.
I would start from getting the velocity from the rigidbody and adding it to the particle systems starting velocity. So when the speed of the ship changes so does the particle systems spray. You have to do it from script.
for(int i = 0; i < steamEmitters.Length; i++) {
steamEmitters[i].startSpeed= steamEmitters[i].startSpeed + aircraftsRigidBody.velocity.z;
}
or something like that. Maybe you can use this as a starting point like I did. The inherit velocity might also work, if on the same gameobject with the rigidbody the force is being applied to, but when dealing with hierachies and childs it might be tricky to get to work.
Answer by Garazbolg · Oct 16, 2015 at 08:46 AM
Your Simulation Space in your particule system, is it set to World or to Local because it might be where your issue come from.
Other then that there is always the inherite velocity property but i don't know if that is what your are looking for.
Simulation space is set to World, so that if the ship fires a cannonball and then begins turning the cannonball will not appear to turn with it. Inherit velocity, as far as I understand, inherits velocity from the object's rigidbody, however, the object that has the Particle System component has no rigidbody. The ship object, of whom the cannon, and subsequently the cannonball particle effect, are children of is the object who has a rigidbody component.