x


How can I make particles respect the rotation of objects, and fix error "!IsFinite(outDistanceForSort)"

I'm making a game that looks like a football game. In my game is a special combo that you're kicking the ball very fast and I created an effect for that. It looks like an explosion in forward direction. The problem is that when I am spinning my character to the right or the left and do the combo - the effect is "exploding" toward the same direction always. Just like it keeps exploding on the z axis even if my character is turned to another way. How I make it "explode" to the direction my character face?

Another question: I want to use the particles on one part of my character and the enemy to show on which team he belongs to. When I put the particles on one of the meshes, the particles doesn't show up and I get that error !IsFinite(outDistanceForSort). It is a character I created in blender. How can I make the particles show?

more ▼

asked Mar 16 '11 at 01:42 PM

Michael 16 gravatar image

Michael 16
71 18 19 27

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

2 answers: sort voted first

Hi Michael. It seems you have either of two cases as to why your particles travel into world-z.

  • The first case is if you have animated your particles in world coordinates, then they will not respect the orientation of your object. You should animate your particles in local coordinates.

  • The second case is if you have animated your particles in local coordinates, you may be placing your object without any rotation. This can happen by mistake if you are creating the particle as a prefab, and position it somewhere and forget to set its rotation. However if you have it parented to some object (as your character), then it is much more likely that you would be in the first case - where you animate the particles for world coordinates rather than local.

more ▼

answered Mar 16 '11 at 01:50 PM

Statement gravatar image

Statement ♦♦
20.2k 35 71 176

The particles are animating in local coordinates and I created it as 2 diffrent prefabs, one for charging the energy and the other for the explotion, The prefabs shows up one after the other only when I click a button. Both prefabs have the problem.

How can i set the rotation?

Mar 16 '11 at 02:39 PM Michael 16

You can set the prefabs forward vector the same as your targets forward vector. For instance, if you are creating a prefab and you have a direction the ball is going to be shot in, you can set your clones rotation like so: effect.transform.forward = motion.normalized; Or if you want to parent something to a node you could have the node point in the proper direction and parent it such as effect.transform.parent = thatNode; effect.transform.position = Vector3.zero; effect.transform.rotation = Quaternion.identity; Or if you are doing this through the editor, just rotate it properly.

Mar 16 '11 at 03:42 PM Statement ♦♦

If you use local coordinates in editor and have it parented to some object, then you can think of the blue axis being forward. (r/g/b color = x/y/z axis)

Mar 16 '11 at 03:43 PM Statement ♦♦

You can also create a rotation from any directional vector using Quaternion.LookRotation http://unity3d.com/support/documentation/ScriptReference/Quaternion.LookRotation.html

Mar 16 '11 at 03:45 PM Statement ♦♦

I can you explane more please? It's hard to me to understand what you said...

Mar 16 '11 at 05:48 PM Michael 16
(comments are locked)
10|3000 characters needed characters left

Answer to your 1st question: Disable Simulate In World Space for the Ellipsoid Particle Emitter.

more ▼

answered Mar 16 '11 at 01:49 PM

efge gravatar image

efge
5.1k 5 14 40

It doesn't works. It was diable before.

Mar 16 '11 at 02:23 PM Michael 16
(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:

x2029
x659
x163
x27

asked: Mar 16 '11 at 01:42 PM

Seen: 1516 times

Last Updated: Mar 16 '11 at 01:58 PM