Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
problems with vec_rotateaxis #246125
01/13/09 18:46
01/13/09 18:46
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline OP
Serious User
Widi  Offline 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: Widi] #246289
01/14/09 14:08
01/14/09 14:08
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Did you go through the function when setting a breakpoint?

In case that gives you no idea what's happening:

Write an file_open_write instruction into the function which writes the value of each step into a file over several loops. Make the same with vec_rotate instead of vec_rotateaxis. Then compare the values and interpret the difference to get an idea what vec_rotateaxis is actually doing.

BTW, why do you need vec_rotateaxis when vec_rotate does the job? They are different functions, they have to give different results, and if one gives you the right results the other give the same results.

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 Offline OP
Serious User
Widi  Offline 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 Offline
Expert
EvilSOB  Offline
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.
Code:
...
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
Re: problems with vec_rotateaxis [Re: EvilSOB] #246368
01/14/09 20:20
01/14/09 20:20
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline OP
Serious User
Widi  Offline OP
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
No, don`t work. But why vec_sub? Temp_vec6 is a Direction - Vector and not an angle...


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1