## camera rotation

Started by Dune, December 24, 2018, 01:33:00 am

#### Dune

##### December 24, 2018, 01:33:00 amLast Edit: December 24, 2018, 01:47:04 am by Dune
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

#### DocCharly65

##### December 24, 2018, 05:15:48 am #1 Last Edit: December 24, 2018, 05:17:32 am by DocCharly65
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]

#### cyphyr

##### December 24, 2018, 05:57:43 am #2
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.
www.richardfraser.co.uk
/|\

Ryzen 9 3900X @3.79Ghz, 64Gb (TG4 benchmark 6:20)
i7 5930K @3.5Ghz, 32Gb (TG4 benchmark 13.44)

#### Dune

##### December 24, 2018, 07:43:32 am #3
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...

#### Dune

##### December 28, 2018, 02:10:57 am #4
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

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.

#### bobbystahr

##### December 29, 2018, 10:03:48 am #5
Very odd, following to find out why in case I run into this. Do the boats both have a zeroed axis?
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

#### Dune

##### December 29, 2018, 11:08:47 am #6
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....

#### bobbystahr

##### December 29, 2018, 05:26:41 pm #7
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.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist