Planetside Software Forums

General => Terragen Discussion => Topic started by: Dune on December 24, 2018, 01:33:00 AM

Title: camera rotation
Post by: Dune on December 24, 2018, 01:33:00 AM
There's something I can't figure out, and it frustrates  >:( I have a boat and I need to match a camera with the angle the boat has. But the camera is pointing north by default and needs to be rotated first to point up. Then I need to add or subtract values from the boat's angle to tilt the cam. But as soon as it's pointing up (cam: X=90ยบ), the Z doesn't respond in the way I want; it only rotates over Y.
Anyone clever enough? Or is it just impossible?

It may be a very silly thing, but I got up this morning thinking it was 07.00 hours, while I saw downstairs that it was 05.00 hours  ::)
Title: Re: camera rotation
Post by: DocCharly65 on December 24, 2018, 05:15:48 AM
Hi Ulco, I know problems like this from my sometimes very complicated camera paths in my spaceship-flyby scenes.

I have played with your file and hope my result will help you a bit.
It' still not perfect but if you invest a little more time it could be a solution.
The z-axis seems to be the final camera01 view direction so I first concentrated on the "blue line" in 3D preview rotating mode.
I took the cubes b-box as orientation and tried to get the "blue line" rectangular to the cubes sides by rotating the camera01 with the  z- and y-axis.
Rotating the camera01 into the wished tilt angle via z-axis was my last step.

Is the result closer to your plan? My method only works via visual adjustment but perhaps it can help you a bit

[attachmini=1]

[attach=2]
[attach=3]
[attach=4]
Title: Re: camera rotation
Post by: cyphyr on December 24, 2018, 05:57:43 AM
This sounds like the old "Gimble lock" problem.
You could try recreating the scene in Lightwave (or your choice of 3d app) and import the camera from there as an .fbx or .chan.
That may help because you could set your rotation space to localas opposed to world.
Title: Re: camera rotation
Post by: Dune on December 24, 2018, 07:43:32 AM
Thanks guys. So it seems there's no simple translation (or some math...) from object to cam, mmmm. I'll do it visually, that's probably the fastest. It's only 3 boats, so...
Title: Re: camera rotation
Post by: Dune on December 28, 2018, 02:10:57 AM
I used a simpler method to get the slightly angled waterline on my 3 boats, but there's something else spooking me. Not a big problem, but I just don't understand. Perhaps another simple explanation  :P

My boats are all on the same altitude, very near 0/0/0, but on one boat I needed to raise the altitude (from distribution shader altitude in terrain), so there's a difference of about 80cm, while the waterlines should all be appr. on same altitude.
Title: Re: camera rotation
Post by: bobbystahr on December 29, 2018, 10:03:48 AM
Very odd, following to find out why in case I run into this. Do the boats both have a zeroed axis?
Title: Re: camera rotation
Post by: Dune on December 29, 2018, 11:08:47 AM
They're 3 of the same boat. But I think I may know, but have to check.... depends on where the disstribution shader takes it's altitude from....
Title: Re: camera rotation
Post by: bobbystahr on December 29, 2018, 05:26:41 PM
Quote from: Dune on December 29, 2018, 11:08:47 AM
They're 3 of the same boat. But I think I may know, but have to check.... depends on where the disstribution shader takes it's altitude from....

cool, seems like you're on the trail to resolution.