Jump to content
  • Advertisement
Sign in to follow this  
guptan

random points around an axis

This topic is 2319 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to get a set of random vectors from a hit point when I cast a ray.
The random vectors should be inside a cone.
Please help.

Share this post


Link to post
Share on other sites
Advertisement
I will give you more details to my question. This is originally for spewing a set of billboards.

When the player shoots a target, a ray is casted towards the target to find the hit point. now hit point - rayDir * randomDistance will give me a point along the ray. Now I want this point to be rotated around the negated rayDir at an angle.

How do I do that?

Share this post


Link to post
Share on other sites
I can divide the problem into two simpler problems for you. First, generate the distribution you want around a reference vector, say (1,0,0). When you are happy with the distribution, you need to rotate the results using a rotation that would map (1,0,0) to line up with -rayDir. Give it a try, and post back if you have trouble with either of the two steps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!