Jump to content

Disable Orbits


Recommended Posts

Hello

how do I change color of an orbit? Is it even possibile? I tried with setcolor and orbitcolor as you can see below but anytime I get a NRE when entering the foreach

 

foreach ( CelestialBody Celestial in FlightGlobals.Bodies )
	Celestial.orbitDriver.Renderer.orbitColor = new Color(0, 0, 0, 0);

Thanks

Edited by brusura
Link to comment
Share on other sites

orbitDriver.Renderer is only assigned in Scenes where the orbit is really rendered (Trackingstation and MapView). But if you want to hide the orbit, setting the color to transparent is not the best thing you can do: Experiment with the drawIcons and drawMode fields in Renderer instead.

Link to comment
Share on other sites

I make sure to be in mapview with MapView.MapIsEnabled  and I tried with drawmode to OFF but same NRE

I had some success following sarbian hints:

 

                    foreach ( CelestialBody Celestial in FlightGlobals.Bodies )
                    {
                        Celestial.DiscoveryInfo.SetLevel(DiscoveryLevels.None);
                        //Celestial.orbitDriver.Renderer.drawMode = OrbitRenderer.DrawMode.OFF;
                        ScreenMessages.print(Celestial.bodyName);
                    }

Still I would like to know what I did wrong trying to change the color :(

 

Basically I need them to be transparent because I do not want to mess with anything else, I making this to reduce clutter while placing more than one manuever nodes , the idea is to show only those orbits:

Orbiting Body
Focused Vessel
Targeted Body/Vessel
Manuever Nodes

Edited by brusura
Link to comment
Share on other sites

  • 2 weeks later...

Hello

I got this mod I am working on, in an almost usable way, but I do not like at all to mess with discovery state of object to hide orbits and I'd like to use drawMode as suggested by @Thomas P. , those are my first steps in modding and I am still trying to figure out what is working and what not, the following code get a NRE right after the ScreenMessages prints in the console:

if (MapView.MapIsEnabled && Input.GetKeyDown(KeyCode.O)
{
	foreach (CelestialBody Celestial in FlightGlobals.Bodies)
             if ((ActiveTargetID != Celestial.bodyName) && (ActualOrbitingBody != Celestial.bodyName))
                        {
                            //Celestial.DiscoveryInfo.SetLevel(DiscoveryLevels.Name);
                                                      
                            ScreenMessages.print(ModName + "Celestial.orbitDriver.Renderer.drawMode = OrbitRenderer.DrawMode.OFF;");
                            Celestial.orbitDriver.Renderer.drawMode = OrbitRenderer.DrawMode.OFF;
                        }
}

 

Any hint would be really appreciated.

 

Thanks

Edited by brusura
Link to comment
Share on other sites

  • 2 weeks later...
On 29/12/2016 at 2:12 PM, linuxgurugamer said:

Try adding the following:


if (Celestial.orbitDriver != null && Celestial.orbitDriver.Renderer != null)
   Celestial.orbitDriver.Renderer.drawMode = ......

 

I'll try that, but every celestial object should have an orbit so it should not be null, I guess?

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