- Home /
Physics on shooting objects/effects
Just a quick and simple question.
Currently when shooting an particle effect prefab, and attaching it to a Rigidbody the effect follows the camera (using physics to shoot it). Basically it shoots just fine if I stay straight, but if move left and right the effect/object itself will move with the camera. I'm just experimenting with simple physics and wondering what a quick solution to this?
My creation uses the simple "(spellFired,spellSpawn1.position, spellSpawn1.rotation)"
The position/rotation is the camera.
The rigid body is as simple as " r.AddForce(transform.forward * 40, ForceMode.Impulse) "
Answer by robertbu · Aug 03, 2013 at 02:08 AM
You need to not make your projectile/effect a child of the camera. If the childing is done and runtime and you are not sure of the code, post it here and someone can spot the line to fix. If the childing is done at edit time, pull the projectile/effect out from under the camera in the Hierarchy.
Thanks for the answer, I've actually fixed it already and haven't been able to find this question to notify. It was a couple of stupid lines within the code that basically hard-attached it to the camera and had absolute no use to the spell itself, no idea why I had it there. Thanks.