Jump to content

How to determine if you are on an EVA?


Recommended Posts

Newbie mod-wannabe here, go easy on me.

I have visual studio and some c# experience. I have already referenced the assembly-csharp.dll and unityengine.dlls successfully, and can access the types.

I'm trying to create a plugin without a part - at least not yet. Most tutorials seem to expect that a part is the main focus of a mod. Therefore I'm a bit uncertain how to proceed, as my class obviously(?) shouldn't inherit from PartModule. I need to determine if the player is currently in "EVA mode", but how do I do that? In fact, it would be great if I could determine whether the player was: 1) flying in internal view, 2) flying in external view, 3) on eva. But EVA is the important part, but basically I want my mod to react to the flight mode.

I guess I could check if the activevessel is a kerbal astronaut, but the specifics are not clear to me. Help appreciated.

Edited by jeti140973
Link to comment
Share on other sites

if your class inherits from monobehaviour, you can override the monobehaviour functions and will thusly have Update/FixedUpdate etc.

Take a look at the posts about KSPAddon on how to instantiate your monobehaviour classes.

If you want to check whether the player is in EVA, you can do this by looking at the active Vessel as accessible through FlightGlobals:


FlightGlobals.ActiveVessel.isEVA

Link to comment
Share on other sites

Ok, I am making some progress, but I can't get the next bit to work. I need to figure out if the player is currently in internal view, ie. is sitting inside the cockpit as opposed to the viewing the craft from the outside. It seems that switching back and forth between external/internal view does neither switch the camera nor the vessel. Does anyone know how to check for this?

Link to comment
Share on other sites

Ok, I am making some progress, but I can't get the next bit to work. I need to figure out if the player is currently in internal view, ie. is sitting inside the cockpit as opposed to the viewing the craft from the outside. It seems that switching back and forth between external/internal view does neither switch the camera nor the vessel. Does anyone know how to check for this?

Try this:

if (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA)

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