Followers 0

# Increasing Line Length

## 4 posts in this topic

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.

0

##### Share on other sites

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

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

1

@eppo: Thanks.

1

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

0

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

0

## Create an account

Register a new account