February 19, 2020, 02:23:26 AM

Author Topic: Lining up things  (Read 106 times)

Offline JBR

  • Jr. Member
  • **
  • Posts: 63
Lining up things
« on: February 12, 2020, 01:07:37 AM »
Hi,

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: 823
    • 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.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal