Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 public string PlaceAt(DefinitionId blockDefinitionId, PlainVec3D position, PlainVec3D orientationForward,
                       PlainVec3D orientationUp)
 {
     return(m_blockPlacer.PlaceBlock(blockDefinitionId, position.ToVector3(), orientationForward.ToVector3(),
                                     orientationUp.ToVector3()).BlockId().ToString());
 }