inteja Posted April 4, 2018 Share Posted April 4, 2018 I know I can't stop gimbal lock but I'd like to avoid the circumstances where it occurs in my application i.e. when a lookAt() call returns a vector close to the zenith. Basically I'd like to clamp the rotational pitch from 0 to 85 degrees, rather than allowing it to ever reach 90 degrees. I see the lookAt method has an optional parameter for pitchCor (pitch correction) but that doesn't seem to do what I want. What I'm thinking at the moment is I need to test the lookAt result to see of it's >= 85 degrees pitch and if so then clamp the pitch back to 85 degrees (without altering yaw) before applying the rotation to my mesh, but I'm a bit lost how to achieve that or if there's a better way. EDIT Here's a PG http://www.babylonjs-playground.com/#NM5LIX Basically as the lookAt() approaches the zenith I want to clamp the pitch input (even though it's not accurate this way) in order to eliminate the unnaturally fast spin. I hope this makes sense. Quote Link to comment Share on other sites More sharing options...
adam Posted April 4, 2018 Share Posted April 4, 2018 Add min max pitch to lookAt: https://www.babylonjs-playground.com/#NM5LIX#2 inteja 1 Quote Link to comment Share on other sites More sharing options...
inteja Posted April 4, 2018 Author Share Posted April 4, 2018 Thanks @adam. That's really helpful. Also, love your profile pic - Commodore logo. Nostalgic for me as I started with Vic20, onto C64 then Amiga ... the good 'ol days :-) adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted April 4, 2018 Share Posted April 4, 2018 Me: Trs-80 -> c64 -> Amiga500 inteja and GameMonetize 1 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 5, 2018 Share Posted April 5, 2018 Trs-80, -> c64 -> c128 -> A500 weird. Didjall see my #1 PG? I tried using a dummy camera... etc, etc. Embarrassing Wing-nutty-ness. Anyone remember forum buddy "Alby"? He and his campfire team would fight-with unwanted spin from lookAt() and billboardMode... DAILY. I think he's in an institution or something, now. Rumor has it... he just mumbles "camera epsilon" and "poles" and "gimbal lock" all day long, and drools a lot. But but but but... doesn't it "feel" like... there is a transformNormal() or some other Matrix transformation that can be done, here (avoiding lookAt)? mesh. bake[Something], perhaps? Or, maybe re-scale the plane at some point... causing it to change its forward() vector? What the heck? In #1 PG, line 15: camera2.noRotationConstraint = true; There, what I really wanted was... .allowUpsideDown, but that is an ARC cam thing (allows arcCam to behave differently... at beta = 0) So, yeah, not only did I contribute NOTHING in this post, but I might have made us all... a little stupider. sorry. heh adam and inteja 2 Quote Link to comment Share on other sites More sharing options...
inteja Posted April 5, 2018 Author Share Posted April 5, 2018 I was young and poor and only drooled over the TRS-80. Used Spectrum ZX and BBC Micros at school though. VIC20 > C64 > A500 > A1200 (sadly skipped the C128 and A4000). I jumped to the PC dark side when Doom came out with a 486 DX 266. There was nothing like 8-bit computing. Long gone are the days when you could know a system inside-out, unless you count Arduino, Raspberry Pi etc... adam and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Guest Posted April 5, 2018 Share Posted April 5, 2018 Amstrad CPC 464->Atari STE (sorry) -> Amiga 500+ inteja and adam 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.