|
Is it possible to lock the axis of a particle? I'm creating a 2D game with 3D graphics and all of my objects z axis are locked however when a particle bounces off an object it's Z depth often changes ruining the whole effect. Thanks in advance!
(comments are locked)
|
|
Have you considered a 2D plane / sprite animation instead of a particle system? There are many middleware solutions (some free) that will get you up and running quickly with potential processing benefits. With the tools at hand in Unity (and without knowing what effect your are trying to achieve) here are a few ideas: Ellipsoid Emitter:
Mesh Emitter:
The Big Hammer:
http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter-particles.html
(comments are locked)
|
|
I recommend going with BoredKoi's recommendation of sprite animations which can be much more performant than particle systems. As for the rest, since you are concerned about the movement after collision, it's not really about how you emit the particles. As BoreKoi stated, you could go through and set positions, but I think it may be easier to just set their "z" velocity to zero in stead.
Your z axis is going to be dependent upon your setup and if you're trying to lock on a setup-relative axis, you will need to transform the velocity into setup-local space and then back again. You can do this with Transform.InverseTransformDirection and Transform.TransformDirection. I believe that velocity is given in world coordinates, but if not, you may have to do twice as many conversions.
When you set this velocity is also important. You could do it every frame in LateUpdate or at a set amount of time in FixedUpdate, but that's all rather inefficient or you could just do this in OnParticleCollision if its only a problem for collisions.
or if you need to do this relative to an arbitrary transform
(comments are locked)
|
