Jump to content
  • Advertisement
Sign in to follow this  
guptan

random points around an axis

This topic is 2467 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!