I’m need to generate random particle directions based upon it’s initial direction moving. Here’s a image of what I mean
1)Object is falling
2) Object hits floor and I need to get a possible range that particles could fly off.
3) Particles fly off at various angles from the object.
I should add this won’t just be for falling objects but for any object hitting something moving in any direction.
Currently I’m cheating a solution like this…
particle.rigidbody2D.AddForce (Vector3.up * 1200f);
float xDir = Random.Range (1, 100);
if (xDir < 50) {
xDir -= 50;
}
xDir = xDir / 100;
xDir *= 10000;
particle.rigidbody2D.AddForce (new Vector2 (xDir, 0f));
Which doesn’t seem to be working very well, there must be a better/easier solution?