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
1
Question by HakJak · May 03, 2015 at 07:30 PM · particlesparticlesystemnormalsblooddecals

(STILL STUCK!) Align Particle Collsion Sub-Emitter (or decal?) with Surface Normal

Okay particle system experts, I really need your help! I've been stuck with this stupid problem for 2 months!! I've learned that decals are probably a better way to go (more efficient?) but I don't know how to instantiate those where the particles hit and in the correct rotation either. I'VE REALLY TRIED HARD BUT I'M REALLY STUCK GUYS!

How can I get a particle sub-emitter to orient itself to match the surface normal of whatever it collides with (terrain and 3D objects)?

I have a blood particle system that looks good, except for one part: the collision sub-emitters. When the blood drops hit a surface, they sub-emit a "splatter" particle. This works well on flat surfaces, but unfortunately when it hits something angled/vertical it doesn't look right and clips. See screenshot for an example of what I'm talking about.

I would like to remove the sub-emitter and use decals instead, if it's not too much trouble for someone to explain how to do that instead?

Will greatly appreciate any help you can provide!!

alt text

bloodsplatterclipping.png (155.9 kB)
Comment
Add comment · Show 6
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 HakJak · May 11, 2015 at 04:39 PM 0
Share

bump Can anyone out there help me?? I need to figure out how to find the surface normal of a particle collision, then make the particle rotate to match. I can't seem to find the answer out there....

avatar image Cherno · May 11, 2015 at 06:10 PM 1
Share

Have you looked at ParticleCollisionEvent and $$anonymous$$onoBehaviour.OnParticleCollision(GameObject)? Looks to me like everything you ask for is right there.

avatar image HakJak · Jul 08, 2015 at 04:44 PM 0
Share

Thanks Cherno, but I'm still stumped. I've re-visited this problem a couple of times during this project, but I still can't figure it out! Can someone please give me a script example? I just want to make the blood splats align to the surfaces they hit. Currently the splatters are sub-particles, but they could be decals ins$$anonymous$$d? Surely someone out there can help me out!

avatar image HakJak · Jul 11, 2015 at 03:35 PM 0
Share

Anyone out there have any help to offer on this???

avatar image HakJak · Jul 22, 2015 at 07:57 PM 0
Share

Nobody? Really??

avatar image MadAce HakJak · Feb 09, 2016 at 06:43 AM 0
Share

Take my advice and forget about it. I've been trying to find a solution for the same thing for months and haven't found ANY information whatsoever or got any help from the forums. All I get for answer is a link to some decal asset that only works in editor and not during gameplay. It's frustrating as hell to see something basic like a decal to be so complicated when games since Doom 1 had it.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by wightwhale · Mar 17, 2016 at 02:18 AM

     private void MoveParticlesOnTerrain(ParticleSystem ps)
     {
         int numParticlesAlive = ps.GetParticles(m_Particles);
         if (m_Particles == null || m_Particles.Length < ps.maxParticles)
             m_Particles = new ParticleSystem.Particle[ps.maxParticles];


         // Change only the particles that are alive
         for (int i = 0; i < numParticlesAlive; i++)
         {
             RaycastHit raycastHit;
             Ray r = new Ray(m_Particles[i].position + Vector3.up * 100f, Vector3.up * -1f);
             if (Physics.Raycast(r, out raycastHit, terrainLayer))
             {
                 Quaternion rot = Quaternion.FromToRotation(Vector3.forward, raycastHit.normal);

                 m_Particles[i].axisOfRotation = Vector3.forward;
                 m_Particles[i].rotation3D = rot.eulerAngles;

                 m_Particles[i].position = new Vector3(m_Particles[i].position.x,
                     gravity.currentTerrain.SampleHeight(m_Particles[i].position) + .1f,
                     m_Particles[i].position.z);
             }
         }

         ps.SetParticles(m_Particles, numParticlesAlive);
     }

     private void MoveParticleSystemOnTerrain(ParticleSystem ps)
     {
         ps.transform.position = new Vector3(ps.transform.position.x,
             gravity.currentTerrain.SampleHeight(ps.transform.position) + .1f,
         ps.transform.position.z);
     }
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 HakJak · Mar 17, 2016 at 10:20 PM 0
Share

Thanks man! I actually did end up finally building a solution. It looks similar to this, so I'm assu$$anonymous$$g it will work.

Sorry to anyone else who came across this post and was stumped. I should have posted my code up here when I figured it out. Forgot all about it.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Particle System's Normal Direction makes the former invisible at a certain angle. 1 Answer

Matching collision normal for sub-emitter 0 Answers

Particle System - trailing blood 2 Answers

How can I create a particle 'vortex' or implosion using Shuriken? 2 Answers

Can I slow down a Particle System? - e.g. Slow Motion Effect 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