• Advertisement
Sign in to follow this  

Increasing Line Length

This topic is 1832 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

Lets say I have two points for raycasting:

 

D3DXVECTOR3 rayFrom(...);
D3DXVECTOR3 rayTo(...);

How do I make the line length "rayFrom" increase?

 

I'm looking to increase the line length each frame.

Share this post


Link to post
Share on other sites
Advertisement

You add the vector from rayFrom to rayTo to rayTo multiplied by some offset.

 

rayTo += normalize(rayTo - rayFrom) * offset;

Share this post


Link to post
Share on other sites

to make any ray longer, you just multiply if by a scalar.

 

Meaning, if you have a ray, and you multiply it by two, the ray is twice as long . . .

Share this post


Link to post
Share on other sites

@smasherprog: I don't want it to be like that.

 

Lets say I have a ray its length is 100, I want to increase it's length slightly by 5 or 8 more, so it become 105.

 

So I want to do something like rayLength(rayTo, 5); this will make the ray length 105 instead of 100

 

The ray length should increase to get more hits, so rayFrom should be the same, rayTo should be increased.

 

Important: rayTo should increase according to its own direction.

Share this post


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

  • Advertisement