0
101 Jun 29, 2009 at 12:22

Hi to all,
Can anyone help me fix this problem.
i am working on collision avoidance for ai vehicle .For that i have to know future position of my aivehicle in a x,z plane. y axis is for rotation only.

Example:
myaicar position & rotation is

position = “200.081 1 -612.843 “;
rotation = “0 1 0 87.0896”; //87.0896 is angle
//x axis rotation is 0
//y axis rotation is 1
//z axis rotation is 0
myaicar target position is
//this is the path my aicar travelling
path1 = “400 -612.843 1”;
path2 = “400 -900.784 1”;
path3 = “200 -900.784 1”;
path4 = “200 -612.843 1”;

i tried it
float speed = 10;
D3DXMATRIX rot;
D3DXVECTOR3 vecf(1,0,0);
D3DXVECTOR3 speedvector;
float X_POSITION =200.081f,Y_POSITION = 1, Z_POSITION =-612.843f;
D3DXMatrixRotationY(&rot,87.0896f);
D3DXVec3TransformNormal(&vecf,&vecf,&rot);
speedvector=vecf*speed;
X_POSITION+=speedvector.x;
Z_POSITION+=speedvector.z;

cout<<X_POSITION<<endl<<Y_POSITION<<endl<<Z_POSITION;

result is fine
206.491
1
-605.168

but i tried to path3 from path2 rotation in y axis rotation is 182.201
result is

410.08
1
-900.729

but i wanted a result like this
400
1
-910

Please someone guide me achieve this

Thanks in advance

—Rajesh—

#### 1 Reply

Please log in or register to post a reply.

0
101 Jul 01, 2009 at 06:01

i solved the above issue .Thank you for the guys tried to help me