public CharacterObservation Teleport(PlainVec3D position, PlainVec3D?orientationForward, PlainVec3D?orientationUp) { var vecPosition = new Vector3D(position.ToVector3()); if (orientationForward == null && orientationUp == null) { GetEntityController().ControlledEntity.Entity.PositionComp.SetPosition(vecPosition); return(m_observer.Observe()); } if (orientationForward == null || orientationUp == null) { throw new InvalidOperationException("Either both or none of the orientations are supposed to be set"); } var matrix = MatrixD.CreateWorld( vecPosition, orientationForward?.ToVector3() ?? Vector3.Zero, orientationUp?.ToVector3() ?? Vector3.Zero ); GetEntityController().Player.Character.PositionComp.SetWorldMatrix(ref matrix); return(m_observer.Observe()); }
public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { Definitions.CheckDefinitionIdExists(blockDefinitionId.ToMyDefinitionId()); return(m_blockPlacer.PlaceSingleBlock(m_session.CurrentCharacterId, blockDefinitionId, position.ToVector3(), orientationForward.ToVector3(), orientationUp.ToVector3()).BlockId().ToString()); }
public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward, PlainVec3D orientationUp) { return(m_blockPlacer.PlaceBlock(blockDefinitionId, position.ToVector3(), orientationForward.ToVector3(), orientationUp.ToVector3()).BlockId().ToString()); }