View more

View more

View more

Image of the Day Submit

IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

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.

4 replies to this topic

#1Medo3337  Members

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.

#2eppo  Members

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;

#3Medo3337  Members

Posted 11 January 2013 - 07:11 PM

@eppo: Thanks.

#4smasherprog  Members

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.

#5Medo3337  Members

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.