Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 989 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Gimbal Lock [Re: frazzle] #175384
01/05/08 02:10
01/05/08 02:10
Joined: Dec 2006
Posts: 78
Nevada, USA
Futurulus Offline
Junior Member
Futurulus  Offline
Junior Member

Joined: Dec 2006
Posts: 78
Nevada, USA
<!-- Just ignore my rambling if you've solved it on your own. -->

Ah, wall-walking! Thanks for the screenshot.

I know how to work with a bunch of vectors here. This figures out a new "forward" vector for your character given an old "forward" vector, an old "floor" normal, and a new "wall" normal that you can get from c_move (untested):
Code:
var tempang[3];
var tempang2[3];

// in a function...
// figure out how the old normal needs to be rotated to change to the new normal
vec_to_angle(tempang, OldNormal);
vec_inverse(tempang);
vec_rotate(NewNormal, tempang);
// you could reuse tempang here but I used a different variable because it means something different now
vec_to_angle(tempang2, NewNormal);

// rotate the old forward vector the same way
vec_set(NewForward, OldForward);
vec_rotate(NewForward, tempang2);
// ...rest of function


The hard part is turning the new forward vector into an Euler angle. Using vec_to_angle would give you the right pan and tilt, but then you'd have to adjust roll.

You could easily figure out top and side vectors (top = NewNormal; left = NewForward CROSS NewNormal) if that info is needed. I've never had much luck converting vectors to Euler angles, though.

Re: Gimbal Lock [Re: Futurulus] #175385
01/05/08 10:12
01/05/08 10:12
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline OP
Expert
frazzle  Offline OP
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Appriciate the input once again Futurulus
The methode like you described it seems logic if you think about it indeed but coverting a vector into an angle using vec_to_angle works good when not adjusting pan, tilt and roll at the same time which is quite difficult in a situation like GL. Therefore you need to inverse pan,tilt and roll to solve that part of the problem but eventually it will lead into inaccurate angles when shiften from normal again due to GL. Anyway, the methode I maded is good enough. It's located in the UR thread

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Page 2 of 2 1 2

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