Skip to main content
GameDev.net gamedev.net
🔒 Locked

Offset Vector Direction

Started by FlyingDemon Apr 4, 2005 at 5:49 PM 0 replies 750+ views
Original Post
FlyingDemon
FlyingDemon
How can I offset a vector by any amount in a random direction? This is for a particle system, and I was trying to add inaccurate particle velocity... I dont want my particles to always come out in a strait line. I'm trying to do this by only giving a Vector( the direction that the emitter uses to fire the particles) and an offset ratio between 1 and 0. Where an offset ratio of 0 make the particles come out in a strait line, and 1 makes them come out in ANY direction. I've tryed so many methods but they allways end up doing something funky, like only comming out in the shape a hemisphere instead of a sphere with a ratio of 1.
JY
JY
If you multiply the random number by 360 you will get a random value between 0 and 360 (degrees) or 2pi (for radians). Do this twice to get two angles which you can then plug into an algorithm to convert from polar co-ordinates to a vector.

"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.