Esempio n. 1
0
        protected void Teleport(OpenTK.Mathematics.Vector3 position)
        {
            var pos = position.Convert();

            pos.Y += 0.4f;
            _charController.Warp(ref pos);
        }
Esempio n. 2
0
        public void SetOrientation(Quaternion orientation)
        {
            var forward   = Vector3.Transform(this.forward, orientation);
            var tkForward = new OpenTK.Mathematics.Vector3(forward.X, forward.Y, forward.Z);
            var tkUp      = new OpenTK.Mathematics.Vector3(up.X, up.Y, up.Z);

            AL.Listener(ALListenerfv.Orientation, ref tkForward, ref tkUp);
        }
Esempio n. 3
0
 protected void Walk(OpenTK.Mathematics.Vector3 dir, float frameDelta)
 {
     if (_charController.OnGround)
     {
         var mat = Node.GetTransform.GlobalTransform;
         mat.ClearTranslation();
         var direction = (new OpenTK.Mathematics.Vector4(-dir) * mat).Xyz.Convert();
         //var direction = new Vector3(mat.M31, 0, mat.M33);
         //direction.Normalize();
         _charController.SetWalkDirection(-direction * frameDelta * WalkSpeed);
     }
 }
Esempio n. 4
0
        public override void OnInput()
        {
            if (StateMaschine.Context.MouseState.IsButtonDown(MouseButton.Middle))
            {
                Camera.Grab();
            }
            else
            {
                Camera.Release();
            }
            if (StateMaschine.Context.KeyboardState[Keys.K])
            {
                _WireFrame = !_WireFrame;
            }

            base.OnInput();
            Camera.ProcessKeyboard();
            Camera.processMouse();
            if (build_mode)
            {
                for (int x = 0; x < 100; x++)
                {
                    var     ray = picker.getIntersectionGround();
                    Vector3 pos = ray.Normalized() * x + Camera.Position;
                    if (pos.Y < 0)
                    {
                        if (StateMaschine.Context.MouseState.IsButtonDown(MouseButton.Left))
                        {
                            if (!wasdown)
                            {
                                if (current_build != "")
                                {
                                    //var t = AddEntity(new StaticOBJModel(current_build,new Vector3(Convert.ToInt16(pos.X),0,Convert.ToInt16(pos.Z)),false));
                                    var t = AddEntity(new House("small_house", new Vector3(Convert.ToInt16(pos.X), 0, Convert.ToInt16(pos.Z))));
                                    build_mode = false;
                                    StateMaschine.Context.CursorVisible = true;
                                }
                            }
                            wasdown = true;
                        }
                        else
                        {
                            wasdown = false;
                        }
                        GetEntity(wellmodel).GetComponent <Transform>().SetPosition(new Vector3(Convert.ToInt16(pos.X), 0, Convert.ToInt16(pos.Z)));
                        break;
                    }
                }
            }
        }
Esempio n. 5
0
        public override void OnStart()
        {
            wellmodel = AddEntity(new StaticOBJModel("house_type01", new Vector3(0, 0, 0), false));

            var t = AddEntity(new House());

            GetEntity(t).GetComponent <Transform>().Position = new Vector3(10, 0, 10);

            Grid           = AddEntity(new Grid((100, 100), 0.02f));
            _LightPosition = new Vector3(100, 100, 0);
            Console.WriteLine("State1 onstart");
            Camera.Start();
            Camera.Position = (50, 50, 50);
            LightManager.OnStart();
            SpatialManager.GeneratedHeightNeg = 10;
            SpatialManager.GeneratedHeightPos = 20;

            base.OnStart();
        }
Esempio n. 6
0
 public RigitBodyBox(OpenTK.Mathematics.Vector3 size)
 {
     Size = size;
 }
Esempio n. 7
0
 public static Vector3 ToNumeric(this OpenTK.Mathematics.Vector3 vector) => new Vector3(vector.X, vector.Y, vector.Z);
Esempio n. 8
0
 public void SetGravity(OpenTK.Mathematics.Vector3 grav)
 {
     World.Gravity = new Vector3(grav.X, grav.Y, grav.Z);
 }
Esempio n. 9
0
 public static System.Numerics.Vector3 ToSystemNumerics(this OpenTK.Mathematics.Vector3 vec)
 => new(vec.X, vec.Y, vec.Z);
Esempio n. 10
0
 public static System.Numerics.Vector3 ToVec3(this OpenTK.Mathematics.Vector3 v)
 {
     return(new System.Numerics.Vector3(v.X, v.Y, v.Z));
 }
Esempio n. 11
0
 private Vector3 GetVec3(OpenTK.Mathematics.Vector3 vec3)
 {
     return(new Vector3(vec3.X, vec3.Y, vec3.Z));
 }