Jump to content

How to rotate internal camera's view?


Recommended Posts

Need some help with internal camera:

When I try to rotate the view while in IVA mode via InternalCamera's transform using any of its Rotate methods, it turns together with cockpit's interior. Seems like that the interior is rendered using the same transform so all the gauges and monitors appear in front of a view regardless it is turned away from the vessels front. So what's the proper way to turn the "eye" view only as if it was moved with RMB? Should I manipulate a kerbal's head instead?

Thanks in advance.

Edited by Ser
Link to comment
Share on other sites

  • 3 weeks later...

I'm trying to do something... I'll update if I find ;)

- - - Updated - - -

I found !!!

CameraManager.Instance.SetCameraMode(CameraManager.CameraMode.IVA);

I don't know why, but it doesn't only set the camera mode to IVA, but it toggles it so when you're in external, it switches to internal, and if you call it again it switches back to external. Try ;)

[EDIT]

OH NO !! I thought you were trying to toggle IVA mode :confused:

Edited by simon56modder
Link to comment
Share on other sites

That's the problem. I'm trying to control the view direction when it is already toggled. And there's a bunch of cameras, transforms and stuff and nothing does well enough.

Edited by Ser
Link to comment
Share on other sites

Have a look at InternalCamera.Instance

Have already messed with it. It looks like the right thing to look at. But when I try to rotate it via its transform it rotates together with cockpit's interior. I.e if rotated 90 degrees in flight then everything looks like nothing happened except for landscape moving perpendicular to view.

Edited by Ser
Link to comment
Share on other sites

sarbian, I've tried many things:

Rotate, RotateAround, RotateAroundLocal, rotation

localRotation.SetLokkRotation doesn't seem to work.

InternalCamera.Instance.transform.localRotation = Quaternion.Euler(0, 40, 0);

makes the view stay at the present direction but the interior rotates left by 40 degress. And than it rotates together with the view if I use RMB to look around :) I could try to recall now what lead the view to rotate together with the interior and than rotate the interior in opposite but that stinks would not work because the interior is bound to the view direction after that. It must be the most crappy camera of all the KSP's

yfI3PgI.png

Edited by Ser
Link to comment
Share on other sites

I don't know the code for this (sorry), but I think you need to get the GameObject inheritance tree. It sounds like the IVA models and props are child objects of the internal camera for some reason if rotating the camera is moving the visible objects in the game world.

D.

Edited by Diazo
Link to comment
Share on other sites

I ran into this exact problem when developing KerbTrack. Here's the solution to it:

// Without setting the flight camera transform, the pod rotates about without changing the background.
FlightCamera.fetch.transform.rotation = InternalSpace.InternalToWorld(InternalCamera.Instance.transform.rotation);

You can see the rest of the code involved here.

Link to comment
Share on other sites

Thanks. I should look in your mod's source code first of all. It works but not in my case :) I'll explain: it holds the specified view direction as long as the command is issued. Otherwise it is returned to default direction by the next frame. But I need to rotate the view once and leave it in that state to make user have to restore it by mouse.

Edited by Ser
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...