x


How can I solve my Mesh Particle Emitter problem?

I have been helped to find out that i can add an MPE with script

var pe : ParticleEmitter = wallChild.AddComponent("MeshParticleEmitter") as ParticleEmitter;

also I have learned that not all variables are exposed to scripting(I need Interpolate Triangles and the Normal Velocities). I am creating different shaped and sized meshes on the fly and want to add the MPE to the mesh. On the bright side, the settings I want from the MPE are always the same, just not the default settings. So can I do any of these things?

  1. Adjust the default settings of MPE when AddComponent is called, it would load the MPE with Interpolate Triangles ON and The Min and Max Normal Velocities to 1 - like the Unity MPE page suggests you set!

  2. I have an MPE on a gameobect in the game with the correct settings. Can I copy the MPE settings from the base mesh to my MPE settings on the created mesh?

  3. Have a prefab with the correct MPE in it and Instantiate it and add to the created mesh. I am trying to do this with little luck as shown.

    var flameFire : Transform = Instantiate(FloorScript.FlameStuff, childWall.position, 
       Quaternion.identity) as Transform;
    flameFire.parent = wall.transform.Find("Cube");
    

    but something is wrong the MPE doesn't take the shape of the mesh of "Cube".

Thank you.

more ▼

asked Nov 20 '10 at 05:44 AM

Twayne gravatar image

Twayne
235 21 22 34

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
  1. No, you can instantiate a prefab that has the settings you want.

  2. No, see 1.

  3. Assigning a parent won't do anything; you assign a mesh to a mesh particle emitter. But you have to do it indirectly by assigning the mesh to the attached MeshFilter component.

    GetComponent(MeshFilter).mesh = desiredMesh; // The ParticleEmitter component will use this mesh
    
more ▼

answered Nov 20 '10 at 06:53 AM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

Thanks again Eric5h5.

Nov 21 '10 at 03:18 AM Twayne
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1359
x319
x89

asked: Nov 20 '10 at 05:44 AM

Seen: 1353 times

Last Updated: Nov 20 '10 at 05:44 AM