Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ROM · Sep 03, 2010 at 10:41 AM · collisioneffectparticlebouncelock

Locking particle axis?

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!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by parveenkhtkr · Mar 14, 2014 at 11:19 PM

I am late to the party but this might be helpful to many out there. Use cone shape and set angel to 90 of cone. Thats it!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Universalerror · Dec 18, 2015 at 01:17 PM 0
Share

This is the same as using the "circle" shape.

avatar image
1

Answer by BoredKoi · Sep 03, 2010 at 03:25 PM

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:

  1. make sure you don't have any crazy tangential / world velocity going
  2. zero the Z property of the Ellipsoid itself on the Emitter component

Mesh Emitter:

  1. Emits particles from verticies; may work alright if you are billboarding your mesh

The Big Hammer:

  1. In LateUpdate, grab the .particles[] and slam their .position(s) wherever you want. Note the copy / reassign required to do this

http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter-particles.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by skovacs1 · Sep 03, 2010 at 03:31 PM

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.

for(var particle : Particle in particleEmitter.particles)
    particle.velocity.z = 0;

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.

//Camera transform relative
var relativeVelocity : Vector3;
relativeVelocity = maincamera.transform.InverseTransformDirection(particle.velocity);
relativeVelocity.z = 0;
particle.velocity = maincamera.transform.TransformDirection(relativeVelocity);

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.

function OnParticleCollision(other : GameObject) {
    for(var particle : Particle in particleEmitter.particles)
        particle.velocity.z = 0;
}

or if you need to do this relative to an arbitrary transform

function OnParticleCollision(other : GameObject) {
    for(var particle : Particle in particleEmitter.particles) {
        var relative : Vector3;
        relative = maincamera.transform.InverseTransformDirection(particle.velocity);
        relative.z = 0;
        particle.velocity = maincamera.transform.TransformDirection(relative);
}
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Trigger particles when collide 0 Answers

Machine Gun Different Hit Particles 0 Answers

Ball bounce problem 1 Answer

Bouncing on collision 0 Answers

Bouce after collision 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges