Jump to content

  • Log In with Google      Sign In   
  • Create Account

Increasing Line Length


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 11 January 2013 - 09:09 AM

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.



Sponsor:

#2 eppo   Crossbones+   -  Reputation: 2458

Like
1Likes
Like

Posted 11 January 2013 - 09:23 AM

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

 

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



#3 Medo3337   Members   -  Reputation: 665

Like
1Likes
Like

Posted 11 January 2013 - 07:11 PM

@eppo: Thanks.



#4 smasherprog   Members   -  Reputation: 432

Like
0Likes
Like

Posted 11 January 2013 - 09:53 PM

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 . . .


Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

#5 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 12 January 2013 - 05:02 AM

@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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS