// Is there night on the given place on planet? Position is in global space. static bool IsThereNight(MyPlanet planet, ref Vector3D position) { // gravitation vector and vector to sun are facing same direction Vector3 grav = planet.GetWorldGravityNormalized(ref position); return(Vector3.Dot(MySector.DirectionToSunNormalized, grav) > 0); }
private void Update10() { MyPlayer player = MySession.Static.LocalHumanPlayer; if (player == null) { return; } MyCubeBlock block = player.Controller.ControlledEntity as MyCubeBlock; if (block == null || block != m_cockpit) { return; } bool skipInput = MyGuiScreenGamePlay.ActiveGameplayScreen != null || MyAPIGateway.Input.IsGameControlPressed(MyControlsSpace.LOOKAROUND); Log.DebugLog("active screen: " + MyGuiScreenGamePlay.ActiveGameplayScreen, condition: MyGuiScreenGamePlay.ActiveGameplayScreen != null); Log.DebugLog("Lookaround", condition: MyAPIGateway.Input.IsGameControlPressed(MyControlsSpace.LOOKAROUND)); Vector3D gridCentre = m_grid.GetCentre(); MyPlanet closest = MyPlanetExtensions.GetClosestPlanet(gridCentre); if (closest.GetAirDensity(gridCentre) == 0f) { return; } Vector3 gravityDirection = closest.GetWorldGravityNormalized(ref gridCentre); if (m_aileron != null) { AileronHelper(ref gravityDirection, skipInput); } if (m_elevator != null) { ElevatorHelper(skipInput); } if (m_rudder != null) { RudderHelper(skipInput); } }