예제 #1
0
 public RigidBody(GameObject Object)
 {
     gameObject      = Object;
     _Mass           = 1;
     _Static         = false;
     _Shape          = new CapsuleShape(0.5f, 1);
     rigidBodyObject = LocalCreateRigidBody(_Mass, Matrix4.CreateTranslation(gameObject._transform.Position), _Shape);
     rigidBodyObject.CollisionFlags = CollisionFlags.CharacterObject;
     rigidBodyObject.Friction       = 0.1f;
     rigidBodyObject.SetDamping(0, 0);
 }
예제 #2
0
파일: FreeCamera.cs 프로젝트: yanko/vengine
 public FreeCamera(float aspectRatio, float fov)
 {
     Cam = new Camera(new Vector3(20, 20, 20), new Vector3(0, 2, 0), aspectRatio, fov, 0.1f, 10000.0f);
     Camera.MainDisplayCamera = Cam;
     collisionShape = new SphereShape(0.8f);
     //collisionShape.LinearDamping = 0.5f;
     rigidBody = World.Root.CreateRigidBody(0.01f, Matrix4.CreateTranslation(Cam.Transformation.GetPosition()), collisionShape, null);
     rigidBody.SetSleepingThresholds(0, 0);
     rigidBody.ContactProcessingThreshold = 0;
     rigidBody.CcdMotionThreshold = 0;
     World.Root.PhysicalWorld.AddRigidBody(rigidBody);
     rigidBody.Gravity = Vector3.Zero;
     rigidBody.ApplyGravity();
     rigidBody.SetDamping(0.5f, 0.01f);
     GLThread.OnUpdate += UpdateSterring;
     GLThread.OnMouseMove += OnMouseMove;
     GLThread.OnKeyUp += (o, e) =>
     {
         if(e.Key == OpenTK.Input.Key.P)
         {
             GravityEnabled = !GravityEnabled;
             if(GravityEnabled)
             {
                 rigidBody.Gravity = new Vector3(0, -9.81f, 0);
                 rigidBody.ApplyGravity();
                 rigidBody.SetDamping(0.8f, 0.01f);
             }
             else
             {
                 rigidBody.Gravity = Vector3.Zero;
                 rigidBody.ApplyGravity();
                 rigidBody.SetDamping(0.5f, 0.01f);
             }
         }
     };
 }
예제 #3
0
파일: FreeCamera.cs 프로젝트: yanko/vengine
 public FreeCamera(float aspectRatio, float fov)
 {
     Cam = new Camera(new Vector3(20, 20, 20), new Vector3(0, 2, 0), aspectRatio, fov, 1.0f, 10000.0f);
     collisionShape = new SphereShape(0.8f);
     //collisionShape.LinearDamping = 0.5f;
     rigidBody = World.Root.CreateRigidBody(0.01f, Matrix4.CreateTranslation(Cam.Transformation.GetPosition()), collisionShape, null);
     rigidBody.SetSleepingThresholds(0, 0);
     rigidBody.ContactProcessingThreshold = 0;
     rigidBody.CcdMotionThreshold = 0;
     World.Root.PhysicalWorld.AddRigidBody(rigidBody);
     rigidBody.Gravity = Vector3.Zero;
     rigidBody.ApplyGravity();
     rigidBody.SetDamping(0.5f, 0.01f);
     GLThread.OnUpdate += UpdateSterring;
     GLThread.OnMouseMove += OnMouseMove;
 }