# Direction Vector Problem

This topic is 2707 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,
I am trying to change XYZ of a point according to a direction vector.

Any idea how can I do that?

##### Share on other sites
The description of exactly what you want to do isn't all that clear.

If you have coordinates ( px, py, pz ) and a normalized direction vector ( dx, dy, dz ), the new point = ( px + s*dx, py + s*dy, pz + s*dz ), where s is the distance you want to move.

##### Share on other sites
I have already done what you told me.

But this game is a bit "gay" The directions are strange, I don't know.

If I start the game and my direction vector is (1,0,0), if i turn around my vehicle of 360°, that vector should be the same(1,0,0), shouldn't it?

BUT IT IS NOT it's (-1,0,0)

I have to turn 720° to get that again (1,0,0)

##### Share on other sites

But this game is a bit "gay" The directions are strange, I don't know.

Seems like your rotation code is screwed up. My random guess? most trig functions take radians not degrees. Maybe that is whats wrong?

##### Share on other sites
It's very strange this game, it's German Truck Simulator, using ODE.
Some other objects in the game, have normal vector directions.

##### Share on other sites
Sorry for dpost.

I understood that if i subtract the first value of my vector (a, 0, -> a-b = right cos and sin

Any more ideas?

##### Share on other sites
Erm, Q-Circles again so soon, read: somewhere (and wrongly) using quaternions ?

That was just a far reached guess. Could you shed some more light by providing code, please ?

##### Share on other sites
Well, the code just Reads process memory and writes.

I have problems understanding how to get a normal vector direction

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631776
• Total Posts
3002299
×