public MyGlobalInputComponent() { AddShortcut(MyKeys.Space, true, true, false, false, () => "Teleport controlled object to camera position", delegate { if (MySession.Static.CameraController == MySpectator.Static) { MyMultiplayer.TeleportControlledEntity(MySpectator.Static.Position); } return(true); }); AddShortcut(MyKeys.NumPad2, true, false, false, false, () => "Apply backward linear impulse x100", delegate { var body = MySession.Static.ControlledEntity.Entity.GetTopMostParent().Physics; if (body != null && body.RigidBody != null) { body.RigidBody.ApplyLinearImpulse(MySession.Static.ControlledEntity.Entity.WorldMatrix.Forward * body.Mass * -100); } return(true); }); AddShortcut(MyKeys.NumPad3, true, false, false, false, () => "Apply linear impulse x100", delegate { var body = MySession.Static.ControlledEntity.Entity.GetTopMostParent().Physics; if (body != null && body.RigidBody != null) { body.RigidBody.ApplyLinearImpulse(MySession.Static.ControlledEntity.Entity.WorldMatrix.Forward * body.Mass * 100); } return(true); }); AddShortcut(MyKeys.NumPad6, true, false, false, false, () => "Apply linear impulse x20", delegate { var body = MySession.Static.ControlledEntity.Entity.GetTopMostParent().Physics; if (body != null && body.RigidBody != null) { body.RigidBody.ApplyLinearImpulse(MySession.Static.ControlledEntity.Entity.WorldMatrix.Forward * body.Mass * 20); } return(true); }); AddShortcut(MyKeys.Z, true, true, true, false, () => "Save clipboard as prefab", delegate { MyClipboardComponent.Static.Clipboard.SaveClipboardAsPrefab(); return(true); }); }
private void OnTeleportToRingButton(MyGuiControlButton button) { if (MySession.Static.CameraController != MySession.Static.LocalCharacter) { CloseScreen(); AsteroidRingShape shape = AsteroidRingShape.CreateFromRingItem(m_selectedPlanet.PlanetRing); MyMultiplayer.TeleportControlledEntity(shape.LocationInRing(0)); m_attachedEntity = 0L; m_selectedPlanet = null; MyGuiScreenGamePlay.SetCameraController(); } }
/// <summary> /// Teleports the player to the selected ring /// </summary> /// <param name="button">Button to call</param> private void OnTeleportToSphere(MyGuiControlButton button) { MyPluginLog.Debug("Teleporting player to " + m_currentSelectedAsteroid.DisplayName); if (MySession.Static.CameraController != MySession.Static.LocalCharacter || true) { if (m_currentSelectedAsteroid != null) { IMyAsteroidObjectShape shape = MyAsteroidSphereProvider.Static.GetAsteroidObjectShape(m_currentSelectedAsteroid); if (shape == null) { MyPluginGuiHelper.DisplayError("Cant teleport to asteroid sphere. It does not exist", "Error"); return; } m_parentScreen.CloseScreenNow(); MyMultiplayer.TeleportControlledEntity(shape.GetPointInShape()); MyGuiScreenGamePlay.SetCameraController(); } } }
void TravelTo(Vector3 positionInMilions) { Vector3D pos = (Vector3D)positionInMilions * 1E6; MyMultiplayer.TeleportControlledEntity(pos); }
public static void TravelToWaypoint(Vector3D pos) { MyMultiplayer.TeleportControlledEntity(pos); }