SyntaxBomb - Indie Coders

Languages & Coding => BlitzMax / BlitzMax NG => MiniB3D => Topic started by: JBR on February 12, 2020, 01:07:37 AM

Title: Lining up things
Post by: JBR on February 12, 2020, 01:07:37 AM

I have a rotating space station rotating around x axis (Pitch).

My camera should match the space station around z axis (Roll). So its entrance is lined up.

Problem is the Roll goes 0-> 180, -180 -> 0 but the Pitch goes 0->90->0->-90->0

So half the time they match, but why does the pitch not go to 180?

I'd post a bit of code but it is an experimental mess.

Thanks, Jim
Title: Re: Lining up things
Post by: Matty on February 12, 2020, 08:40:53 AM
Greetings JBR you are better off aligning things using thenvector commands like align to vector than rotating via pitch and roll.

You will need to match the forwards and up vectors of the camera in order to do this easily.

The tformnormal commands will allow you to get the curremt forwards and up vectors from local space to world space.

Then you simply use aligntovector to align along relevant axes.

That should do it.
SimplePortal 2.3.6 © 2008-2014, SimplePortal