Jump to content

Planetarium Camera help


Recommended Posts

So I've been messing around with writing a kerbcam-like plugin that works in the mapview. Since the PlanetariumCamera seems to be locked in place, I haven't had any luck manually moving it.

I've been able to add a camera and set it's parent to be the planetarium camera and move that around successfully, however, the SunFlare doesn't show up.

Here is the code I'm using for creating the camera:

        GameObject go = new GameObject();
newCam = go.AddComponent<Camera>();
newCam.CopyFrom(ScaledCamera.Instance.camera);
newCam.transform.parent = ScaledCamera.Instance.camera.transform;
newCam.depth = ScaledCamera.Instance.camera.depth+1;
newCam.clearFlags = CameraClearFlags.Depth;

Here is what I mean by the flare not showing up:

woDKOWW.jpg

I've tried modifying the culling mask, but haven't had any luck. Everything else works great; the planets, skybox, ect all show up. I just can't figure out how to get the SunFlare to show up. Does anyone have any suggestions?

Link to comment
Share on other sites

https://github.com/Anatid/XML-Documentation-for-the-KSP-API/blob/master/src/PlanetariumCamera.cs

Referencing PlanetariumCamera should allow you to set the stock cam position manually. That way you wont need to deal with hacking back the flares etc.

I havent tested it but i was able to set the vabcam position by scripting this way

Edited by landeTLS
Link to comment
Share on other sites

But I can't move the transforms directly because the game is pulling it back to it's original place. Sure, I can reference PlanetariumCamera to move it around whichever MapObject it is focused on, but I want to be able to move it in any direction and rotation I please. I'm able to do this to the camera I've created, I just can't figure out how to get the Flare to show up.

Link to comment
Share on other sites

But I can't move the transforms directly because the game is pulling it back to it's original place. Sure, I can reference PlanetariumCamera to move it around whichever MapObject it is focused on, but I want to be able to move it in any direction and rotation I please. I'm able to do this to the camera I've created, I just can't figure out how to get the Flare to show up.

Ok then thats another cup of tea. Id suggest reading up on the unity doc for the camera and flare component. Since the stock camera classes impliment those with some extra code ontop. Layer mask perhaps? Im only thinking out loud. Im sure someone else here can come up with a better answer.

Link to comment
Share on other sites

From unity doc : A Camera has to have a Flare Layer Component attached to make Flares visible (this is true by default, so you don’t have to do any set-up).

Reding the doc I doubt CopyFrom copy the attached components of the camera and the "true by default" most likely only applies to the editor only. Check the child component of the stock cam and yours, see if you can add the missing one from code.

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...