示例#1
0
        public IntPtr AddBoxCollider(PxBoxCollider box)
        {
            IntPtr boxPtr = PhysXDll.AddBoxCollider(this.scenePtr, box.ColliderData, box.IsDynamic);

            this.Colliders.Add(boxPtr, box);
            return(boxPtr);
        }
示例#2
0
        public IntPtr AddCapsuleCollider(PxCapsuleCollider capsule)
        {
            IntPtr capsulePtr = PhysXDll.AddCapsuleCollider(this.scenePtr, capsule.ColliderData, capsule.IsDynamic);

            this.Colliders.Add(capsulePtr, capsule);
            return(capsulePtr);
        }
示例#3
0
        public static PxVec3 GetControllerPosition(IntPtr p)
        {
            var position = new PxVec3();

            PhysXDll.GetControllerPosition(p, ref position);
            return(position);
        }
示例#4
0
        public IntPtr AddMeshCollider(PxMeshCollider mesh)
        {
            IntPtr meshPtr = PhysXDll.AddMeshCollider(this.scenePtr, mesh.ColliderData, mesh.ColliderData.vertices, mesh.ColliderData.triangles);

            this.Colliders.Add(meshPtr, mesh);
            return(meshPtr);
        }
示例#5
0
        public IntPtr AddSphereCollider(PxSphereCollider sphere)
        {
            IntPtr spherePtr = PhysXDll.AddSphereCollider(this.scenePtr, sphere.ColliderData, sphere.IsDynamic);

            this.Colliders.Add(spherePtr, sphere);
            return(spherePtr);
        }
示例#6
0
        public static PhysicsScene CreateScene()
        {
            IntPtr       p     = PhysXDll.CreateScene();
            PhysicsScene scene = new PhysicsScene(p);

            scenes[p] = scene;
            return(scene);
        }
示例#7
0
 public static void Release()
 {
     if (isInited)
     {
         PhysXDll.Release();
     }
     isInited = false;
 }
示例#8
0
 public static void Initialize()
 {
     if (!isInited)
     {
         PhysXDll.SetErrorCallback(onErrorOutput);
         PhysXDll.Initialize();
         PhysXDll.RegistSceneUpdateCallback(onSceneUpdate);
         isInited = true;
     }
 }
示例#9
0
        public static IntPtr AddCharacterController(IntPtr scene, PxCapsuleController controller)
        {
            PhysXDll.OnFilterCallback filterWorld      = null;
            PhysXDll.OnFilterCallback filterController = null;

            PhysXDll.OnHitCallback hitShape      = null;
            PhysXDll.OnHitCallback hitController = null;

            if (controller.Filter != null)
            {
                filterWorld      = onFilterWorld;
                filterController = onFilterController;
            }

            if (controller.HitReport != null)
            {
                hitShape      = onHitShape;
                hitController = onHitController;
            }

            return(PhysXDll.AddCharacterController(scene, controller.ControllerData,
                                                   filterWorld, filterController, hitShape, hitController));
        }
 public bool CapsuleCast(CapsuleAxis axis, PxVec3 center, float radius, float halfHeight, PxVec3 direction, float maxDistance, PxVec4 orientation)
 {
     return(PhysXDll.CapsuleCast(this.scenePtr, (int)axis, center, direction, radius, halfHeight, orientation, maxDistance));
 }
示例#11
0
 public static void SetActorTransform(IntPtr p, PxVec3 position, PxVec4 rotation)
 {
     PhysXDll.SetActorTransform(p, position, rotation);
 }
示例#12
0
 public static void SetFilterEnabled(IntPtr p, bool enabled)
 {
     PhysXDll.SetFilterEnabled(p, enabled);
 }
示例#13
0
 public static void IgnoreControllerLayerCollision(int layer1, int layer2, bool ignore = true)
 {
     PhysXDll.IgnoreControllerLayerCollision(layer1, layer2, ignore);
 }
示例#14
0
 public int SphereCastAll(PxVec3 origin, float radius, PxVec3 direction, float maxDistance,
                          int layerMask)
 {
     return(PhysXDll.SphereCastAll(this.scenePtr, origin, direction, radius, maxDistance, layerMask, this.RaycastHits));
 }
 public bool Raycast(PxVec3 origin, PxVec3 direction, float maxDistance, int layerMask)
 {
     return(PhysXDll.Raycast(this.scenePtr, origin, direction, maxDistance, layerMask));
 }
示例#16
0
 public bool SphereCast(PxVec3 origin, PxVec3 direction, float radius)
 {
     return(PhysXDll.SphereCast(this.scenePtr, origin, direction, radius, -1));
 }
示例#17
0
 public void RemoveCollider(IntPtr colliderPtr)
 {
     NLog.Log.Assert(this.Colliders.Remove(colliderPtr));
     PhysXDll.RemoveCollider(this.scenePtr, colliderPtr);
 }
示例#18
0
 public static void ReleaseScene(IntPtr scenePtr)
 {
     NLog.Log.Assert(scenes.Remove(scenePtr));
     PhysXDll.ReleaseScene(scenePtr);
 }
示例#19
0
 public static void SetShapeInSceneQueryEnabled(IntPtr p, bool enabled)
 {
     PhysXDll.SetShapeInSceneQueryEnabled(p, enabled);
 }
示例#20
0
 public static void SetActorGravity(IntPtr p, bool useGravity)
 {
     PhysXDll.SetActorGravity(p, useGravity);
 }
 public bool CapsuleCast(CapsuleAxis axis, PxVec3 center, float radius, float halfHeigh, PxVec3 direction, out PxRaycastHit hitInfo, float maxDistance, int layerMask, PxVec4 orientation)
 {
     return(PhysXDll.CapsuleCast(this.scenePtr, (int)axis, center, direction, radius, halfHeigh, orientation, maxDistance, layerMask, out hitInfo));
 }
 public int CapsuleCastAll(CapsuleAxis axis, PxVec3 center, float radius, float halfHeigh, PxVec3 direction, float maxDistance, int layerMask, PxVec4 orientation)
 {
     return(PhysXDll.CapsuleCastAll(this.scenePtr, (int)axis, center, direction, radius, halfHeigh, orientation, maxDistance, layerMask, this.RaycastHits));
 }
 public bool Raycast(PxVec3 origin, PxVec3 direction)
 {
     return(PhysXDll.Raycast(this.scenePtr, origin, direction, -1));
 }
 public bool Raycast(PxVec3 origin, PxVec3 direction, out PxRaycastHit hitInfo, float maxDistance)
 {
     return(PhysXDll.Raycast(this.scenePtr, origin, direction, maxDistance, out hitInfo));
 }
示例#25
0
 public bool SphereCast(PxVec3 origin, float radius, PxVec3 direction, out PxRaycastHit hitInfo)
 {
     return(PhysXDll.SphereCast(this.scenePtr, origin, direction, radius, -1, out hitInfo));
 }
示例#26
0
 public static CollisionFlags Move(IntPtr p, PxVec3 motion, ref PxVec3 footPos)
 {
     return((CollisionFlags)PhysXDll.MoveController(p, motion, ref footPos));
 }
示例#27
0
 public bool SphereCast(PxVec3 origin, float radius, PxVec3 direction, out PxRaycastHit hitInfo, float maxDistance, int layerMask)
 {
     return(PhysXDll.SphereCast(this.scenePtr, origin, direction, radius, maxDistance, layerMask, out hitInfo));
 }
示例#28
0
 public void Update(float deltaTime)
 {
     PhysXDll.Update(this.scenePtr, deltaTime);
 }
 public int RaycastAll(PxVec3 origin, PxVec3 direction, float maxDistance)
 {
     return(PhysXDll.RaycastAll(this.scenePtr, origin, direction, maxDistance, this.RaycastHits));
 }