예제 #1
0
 public PlayerView(Player player)
 {
     if (player == null)
     {
         throw new ArgumentNullException(nameof(player));
     }
     _player      = player;
     _cameraPivot = Entity.Spawn("CameraPivot", Vector3.Zero, Quaternion.Identity, Vector3.One);
     _camera      = Entity.SpawnWithComponent <ViewCamera>("Player Camera", Vector3.Zero, Quaternion.Identity, Vector3.One);
 }
예제 #2
0
        public PlayerView(Player player)
        {
            _player      = player ?? throw new ArgumentNullException(nameof(player));
            _cameraPivot = Entity.Spawn("CameraPivot", Vector3.Zero, Quaternion.Identity, Vector3.One);
            _camera      = Entity.SpawnWithComponent <ViewCamera>("PlayerCamera", Vector3.Zero, Quaternion.Identity, Vector3.One);

            // raycasated cursor
            _debugRaycastPoint = Entity.Spawn("RaycastPoint", _player.Entity.Position, _player.Entity.Rotation, Vector3.One * 0.12f);
            _debugRaycastPoint.LoadGeometry(0, Primitives.Sphere);
            _debugRaycastPoint.LoadMaterial("materials/user_defaultmat");
            _debugRaycastPoint.SetViewDistanceRatio(1.0f);             // always render regardless of the distance
        }