# Direction Vector Problem

## Recommended Posts

Hello,
I am trying to change XYZ of a point according to a direction vector.
[img]http://img132.imageshack.us/img132/5442/89241639.jpg[/img]

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 [b]s[/b] 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" [img]http://public.gamedev.net/public/style_emoticons/default/laugh.gif[/img] 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
[quote name='tlovidiu' timestamp='1298397026' post='4777600']
But this game is a bit "gay" [img]http://public.gamedev.net/public/style_emoticons/default/laugh.gif[/img] The directions are strange, I don't know.
[/quote]
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, [url="http://www.iracing.com/news/blog/q-circles-the-crop-circles-of-iracing/"]Q-Circles[/url] 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