2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Simple but annoying Bug VEC_ROTATE
#397131
03/14/12 21:13
03/14/12 21:13
|
Joined: Jan 2009
Posts: 78 always overseas
SeaCancer
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 78
always overseas
|
today I found very simple but very annoying Bug,,
It is related to the: vec_rotate (VECTOR* vDir, ANGLE* vAng)
this function is useful in many programming issues like camera and movement vectors
However, this function is not giving correct results if the vector that you want to rotate is not aligned to the axis
i.e: vector (10,10,10) if you want to rotate it around the origin by angles 90,45,0
you will have very funny results that are totally wrong at all
so try to avoid this function now also: ang_rotate
same error!
It only gives right results if you want to rotate a vector that is aligned to the xyz axis, like vector (10,0,70)
or if you rotate a vector without changing the tilt componant i.e rotate vector (10,10,10) using the angles (90,0,0) this will work (only accept pan angle)
Last edited by SeaCancer; 03/14/12 21:20.
|
|
|
Re: Simple but annoying Bug VEC_ROTATE
[Re: SeaCancer]
#397138
03/15/12 00:52
03/15/12 00:52
|
Joined: Jan 2009
Posts: 78 always overseas
SeaCancer
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 78
always overseas
|
I got the problem clearly now if you have a vector not aligned to the xyz axis example camera_dir (10,20,30) Now, if you want vec_rotate to rotate this vector by a "tilt" angle only, it will destroy the "pan" angle that you do not want to change and if you want vec_rotate to rotate a vector by a pan angle & tilt, here is the disaster
|
|
|
Re: Simple but annoying Bug VEC_ROTATE
[Re: SeaCancer]
#397140
03/15/12 04:46
03/15/12 04:46
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
You still arent being clear (to me at least) with what you are trying to achieve.
There are many different vector/angle manipulation functions, and I suspect you just need to find the 'right' one, which isnt always easy. OR there is a chance that you are hitting the dreaded 'gimbal lock' issue. If vec_rotate was ACTUALLY bugged, it would be affecting a great many people...
Can you give a few SIMPLE examples of what results you are expecting... eg: (10,10,10) + (0,15,0) = (10,25,10) (20,20,20) + (15,20,25) = (35,40,45) and the like...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Simple but annoying Bug VEC_ROTATE
[Re: SeaCancer]
#397153
03/15/12 14:56
03/15/12 14:56
|
Joined: Jan 2009
Posts: 78 always overseas
SeaCancer
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 78
always overseas
|
here we go: ANGLE test; function EvilSOB () { var vectot_test [3]; vec_set (vectot_test,vector (10,10,10)); vec_rotate (vectot_test, vector(0,0,0)); // rotation angles change here vec_to_angle (test,vectot_test); } just put the angle test as "watched" variable, you can see that the angles of this vector is (45,35.26,0), this is 100% right Now let us rotate it another 45 pan: the result is (90,35.26,0), this is 100% right too NOW, let us rotate it 30 pan and 10 tilt just change the rotation angles to 30,10,0 in the code the result is: 81,42,0 this is totally wrong! the right values are (75,45.26,0) NOW, let us rotate it 10 tilt just change the rotation angles to 0,10,0 in the code the result is: 51,42,0 this is totally wrong! the right values are (45,45.26,0) So, the calculations of tilt are affecting the pan and vice versa
Last edited by SeaCancer; 03/15/12 14:57.
|
|
|
Re: Simple but annoying Bug VEC_ROTATE
[Re: Tobias]
#397163
03/15/12 21:39
03/15/12 21:39
|
Joined: Jul 2007
Posts: 424 EUROPE
maslone1
Senior Member
|
Senior Member
Joined: Jul 2007
Posts: 424
EUROPE
|
Don't say `kill` :-) . Just terminate :-)
A8c, Blender, FlStudio, Unity3d
|
|
|
Re: Simple but annoying Bug VEC_ROTATE
[Re: maslone1]
#398025
03/26/12 15:35
03/26/12 15:35
|
Joined: Jan 2009
Posts: 78 always overseas
SeaCancer
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 78
always overseas
|
Hi Tobias, Hi maslone1 ang_add did the same my background in math is good, look I will tell you something, Just try it: set a vector to the value of: (10,10,10); by logic the absolute pan is 45 and the tilt is 35.26 NOW, rotate it 30 pan and 10 tilt the new angles will be: 81,42,0 this is totally wrong! OR: asume that I want to increase the tilt only, to rise the camera as example, VEC_ROTATE will change my pan,, why?? I want the pan angle fixed I solved this issue by adding 2-3 lines of code, but I am writting this for other users the right values are (75,45.26,0)
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|