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 samhiscock · Feb 27, 2014 at 06:42 PM · particle systemparticleskinned mesh rendererworld spacelocal space

Changing particles in particle system from local space of skinned character mesh to world space (unattached)

Hi,

First off I'm still new to Unity, C# and Javascript - come from a Python/C++/Maya Scripting background. Not sure if this should be in the forum instead, but anyway.

I'm currently working on a project in which I need to have particles attached to the vertices of a skinned (animated) mesh when they are created, but then they need to be in world space for every frame after that (end result will be sort of a ghosting effect!)

I currently have it so that the mesh for the skinned character controller is being baked out each frame, its vertices are put into an array and these positions are passed to particles in a particle system (which is attached in the same place as the script but has been made inert), which is set every frame.

So the particles follow the animated mesh around fine (there's a tiny bit of lag but I don't mind that for now). The only problem is the script is a component under the Bip001 Pelvis part of the default 3rd Person Controller, firstly so it can access the Skinned Mesh Renderer (needed for baking the mesh each frame) and secondly so it actually follows the position and orientation of the character animation. I tried putting the script into its own empty GameObject and accessing the necessary objects and components from there but it only introduced more problems! Is there any easy way to make particles that are instanced from a script parented under the character stop following it after they are spawned, essentially??

I know this is a fairly complex/confusing setup but any advice would be great. (Sorry for the crude image too! - and ignore the other Emitter, that was for testing)

alt text

My other issue is that I think the particles are ignoring my assignment of attributes such as the size and instead go by the inert Particle System, when I both create them and update them based on the changing mesh - no idea why this is. Do the attributes for the Particle System Component in the Inspector take precedence over scripts?

     private void CreatePoints (Vector3[] verts, ParticleSystem.Particle[] points) 
     {
         
         for (int i = 0; i < resolution; i++)
         {
             points[i].position = verts[i];
             points[i].color = new Color(1f, 1f, 1f);
             points[i].size = 100f;
             points[i].lifetime = 1; 
         }
     }
 
     public void SetPoints (Vector3[] verts, ParticleSystem.Particle[] points)
     {
         Debug.Log("Length of verts array");
         Debug.Log(verts.Length);
 
         for (int ii = 0; ii < resolution; ii++)
         {    
             points[ii].position = verts[ii];
             points[ii].color = new Color(1f, 1f, 1f);
             points[ii].size = 1f;  
             points[ii].lifetime = 1;
         }
         
     }


helpunity.png (65.3 kB)
Comment
Add comment · Show 2
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 samhiscock · Feb 27, 2014 at 07:04 PM 0
Share

Update: I've moved the script and particle system into a separate empty object but have the problem that when I position the particles onto the Bip001 Pelvis of the Character Controller, the mesh is at the wrong angle. The pelvis part is at the wrong orientation when you look at it in the Assets folder too! Does anyone know why this is?

avatar image samhiscock · Mar 01, 2014 at 12:37 PM 0
Share

FURTHER UPDATE: All sorted (for now!) so no help needed. Can I delete questions?

0 Replies

· Add your reply
  • Sort: 

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

20 People are following this question.

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

Related Questions

Can you still not change the Velocity of spawned particles? 2 Answers

Optimizing the Performance of a Large Particle System 2 Answers

how to rotate particles in a particle system 1 Answer

how to use the unity3d 5.3 particle system shape of skinned mesh renderer? 2 Answers

Mesh Particle Emitter & Animation 0 Answers


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