1 registered members (AndrewAMD),
1,014
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
problems with vec_rotateaxis
#246125
01/13/09 18:46
01/13/09 18:46
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
OP
Serious User
|
OP
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
I have some problems with vec_rotateaxis. Here is my code:
void attach_weapon(vertex_1,vertex_2,vertex_3,plus_pan,plus_tilt,plus_roll) { // Arm vorne / Arm hinten / Arm oben / seitlich / höhe / roll proc_mode = PROC_LATE; set (my,PASSABLE); while (you) { vec_for_vertex (Temp_vec1,you,vertex_1); vec_for_vertex (Temp_vec2,you,vertex_2); vec_for_vertex (Temp_vec3,you,vertex_3); vec_set (my.x, Temp_vec2); vec_diff (Temp_vec4, Temp_vec2, Temp_vec1); vec_diff (Temp_vec5, Temp_vec2, Temp_vec3); vec_cross (Temp_vec6,Temp_vec5, Temp_vec4); vec_to_angle (Temp_ang1, Temp_vec4); vec_to_angle (Temp_ang2, Temp_vec5); vec_to_angle (Temp_ang3, Temp_vec6); Test0 = Temp_vec4.x; Test1 = Temp_vec4.y; Test2 = Temp_vec4.z; vec_rotateaxis (Temp_vec4,Temp_vec6,60); Test3 = Temp_vec4.x; Test4 = Temp_vec4.y; Test5 = Temp_vec4.z;
// more code here // my.roll = Temp_ang3.tilt + plus_roll; my.pan = Temp_ang2.tilt + plus_pan; my.tilt = Temp_ang1.tilt + plus_tilt; wait(1); } }
I want to rotate the Direction Temp_vec4 around the axis Temp_vec6. But after vec_rotateaxis the Direction Temp_vec4 is not right, it is change his Direction every frame, jumping from one dir. to another dir. If i erase all vec_to_angle, vec_rotateaxis make nothing, Test0 = Test3, Test1 = Test4, Test2 = Test5. Is this a bug or do i something wrong?
PS: with vec_rotate it works correct...
Last edited by Widi; 01/14/09 18:30.
|
|
|
Re: problems with vec_rotateaxis
[Re: Pappenheimer]
#246333
01/14/09 18:01
01/14/09 18:01
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
OP
Serious User
|
OP
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
Thanks for the Answer. I want to rotate one Direction around another Direction, and that i have to do with vec_rotateaxis, vec_rotate isn`t the solution.
Will check my code with file_open_write...
EDIT: ok, i test it. If i don`t use vec_to angle, all is correct in my log, vec_rotateaxis do nothing. If i let the code as below, before vec_rotateaxis all is right. But after it Temp_vec4 is jumping around.
I try to figure out it also with draw_line3d, and i see the same result: If Temp_vec4 is jumping, he jump not in the right Direction (around axis Temp_vec6) ???
Last edited by Widi; 01/14/09 18:29.
|
|
|
Re: problems with vec_rotateaxis
[Re: Widi]
#246361
01/14/09 19:51
01/14/09 19:51
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Please humor me and TRY this, if it helps I will explain. Insert this one line of code and try it with the log file ON. ...
Test2 = Temp_vec4.z;
vec_sub(Temp_vec6, vector(180,180,180)); //Add this line
vec_rotateaxis (Temp_vec4,Temp_vec6,60);
... Any difference at all??
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|