January 16, 2021, 03:15:12 PM

Author Topic: Lining up things  (Read 572 times)

Offline JBR

  • Full Member
  • ***
  • Posts: 122
Lining up things
« 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

Offline Matty

  • Hero Member
  • *****
  • Posts: 1332
    • MattiesGames
Re: Lining up things
« Reply #1 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.
I eat cheese in the trees when its eight degrees


SimplePortal 2.3.6 © 2008-2014, SimplePortal