Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Gimbal Lock Solution - No Math/Plugins

Author
Message
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 21st Jan 2014 21:21 Edited at: 22nd Jan 2014 17:39
(See below)

Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 22nd Jan 2014 11:23
Would you be able to give us an example of Gimbal Lock cause I replicated your code just using rotate camera and got no issue.

"Get in the Van!" - Van B
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 22nd Jan 2014 13:49 Edited at: 22nd Jan 2014 14:15
Quote: "Would you be able to give us an example of Gimbal Lock cause I replicated your code just using rotate camera and got no issue."


That would be awesome!
Let's see what you came up with, if you don't mind.

Here's my camera only with Gimbal Lock:



Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 22nd Jan 2014 14:24
It's cause your combining two different types of rotation. But if you just replace pitch camera down with rotate camera Pitch#,yd#+T#,0 it'll work fine.

"Get in the Van!" - Van B
chafari
Valued Member
19
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Jan 2014 15:21
Quote: " keeping the Y rotation nice and clean."


Hi there.
What about this solution? .




I'm not a grumpy grandpa
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 22nd Jan 2014 17:15
Quote: "What about this solution?"



Nice, Chafari!
So the trick there is to rotate Limb 0 instead of the object itself?

But how do we make the camera see from the object's perspective?
Rotating the camera to the limb doesn't seem to work for me.

Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 22nd Jan 2014 17:37
Quote: "It's cause your combining two different types of rotation. But if you just replace pitch camera down with rotate camera Pitch#,yd#+T#,0 it'll work fine."


Right you are!

Well I guess Gimbal Lock never really existed for smart people. LoL
I suppose it's like polio; once a menace but now seldom an issue.

Oh well, not my first or last attempt at reinventing the wheel around here.

chafari
Valued Member
19
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Jan 2014 17:47
Quote: "But how do we make the camera see from the object's perspective?
Rotating the camera to the limb doesn't seem to work for me."

We need another trick...could be made in many ways, something like this.



I'm not a grumpy grandpa
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 22nd Jan 2014 19:11 Edited at: 22nd Jan 2014 19:13
Quote: "Oh well, not my first or last attempt at reinventing the wheel around here."


Very true, it's like what I came up with when I was trying to do the roll equivalent of pitch in Euler. I ended up creating some crazy function before I found that you could just change the order of rotation to ZYX

Btw, here's crazy function that actually is quite useful, basically the maths equivalent of rotation in ZYX order for XYZ order:


"Get in the Van!" - Van B
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 23rd Jan 2014 00:26
Thanks for sharing these great techniques, guys!
My goal is always to simplify my code to the least amount of lines, although I often miss obvious shortcuts like Chafari's move object 1,(upkey()-downkey())*0.1

I think I *might* still use a dummy object, if only for the ease of strafing with MOVE OBJECT LEFT/RIGHT because there is no MOVE CAMERA LEFT/RIGHT command. I realize, though I could just rotate +90/-90, move the camera, then rotate back, but the other way sounds more appealing to me.

chafari
Valued Member
19
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2014 01:35
Quote: " I realize, though I could just rotate +90/-90, move the camera, then rotate back
"


Yes you are right !! we could do:



If not, like in old DBC with newxvalue/newzvalue



I'm not a grumpy grandpa
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 1st Feb 2014 16:58
search the forum for point limb function. it may help you with your problem

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 3rd Feb 2014 14:53
Quote: "if only for the ease of strafing with MOVE OBJECT LEFT/RIGHT because there is no MOVE CAMERA LEFT/RIGHT command"


They're included in IanM's Matrix1 plugins. If you don't already have them then get them. I find them indispensable. Look near the top of the DLL board.



Powered by Free Banners

Login to post a reply

Server time is: 2025-05-15 10:48:37
Your offset time is: 2025-05-15 10:48:37