当前位置: 首页>>代码示例>>C#>>正文


C# PhysX类代码示例

本文整理汇总了C#中PhysX的典型用法代码示例。如果您正苦于以下问题:C# PhysX类的具体用法?C# PhysX怎么用?C# PhysX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PhysX类属于命名空间,在下文中一共展示了PhysX类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReportError

        public override void ReportError(PhysX.ErrorCode errorCode, string message, string file, int lineNumber)
        {
            string errorMessage = String.Format("[InWorldz.PhysxPhysics] PhysX ERROR: Code: {0}  Message: {1} ({2}:{3})",
                new object[] { errorCode, message, file, lineNumber });

            if (errorMessage == lastMessage && lastMessageRepeat < MAX_MESSAGES_BEFORE_NOTIFICATION)
            {
                lastMessageRepeat++;
                return;
            }
            else
            {
                if (lastMessageRepeat != 0)
                {
                    m_log.ErrorFormat("[InWorldz.PhysxPhysics] PhysX ERROR: (Last physics message repeats {0} times)", lastMessageRepeat);
                    lastMessageRepeat = 0;
                }

                lastMessage = errorMessage;
            }

            m_log.ErrorFormat(errorMessage);

            if (Settings.Instance.ThrowOnSdkError)
            {
                throw new PhysxSdkException(errorMessage);
            }
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:28,代码来源:PhysxErrorCallback.cs

示例2: OnShapeHit

 public override void OnShapeHit(PhysX.ControllerShapeHit hit)
 {
     if (OnShapeHitCallback != null)
     {
         OnShapeHitCallback(hit);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:UserControllerHitReportDelegator.cs

示例3: OnContact

 public override void OnContact(PhysX.ContactPairHeader contactPairHeader, PhysX.ContactPair[] pairs)
 {
     if (OnContactCallback != null)
     {
         OnContactCallback(contactPairHeader, pairs);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:SimulationEventCallbackDelegator.cs

示例4: OnTrigger

 public override void OnTrigger(PhysX.TriggerPair[] pairs)
 {
     if (OnTriggerCallback != null)
     {
         OnTriggerCallback(pairs);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:SimulationEventCallbackDelegator.cs

示例5: OnSleep

 public override void OnSleep(PhysX.Actor[] actors)
 {
     if (OnSleepCallback != null)
     {
         OnSleepCallback(actors);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:SimulationEventCallbackDelegator.cs

示例6: OnWake

 public override void OnWake(PhysX.Actor[] actors)
 {
     if (OnWakeCallback != null)
     {
         OnWakeCallback(actors);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:SimulationEventCallbackDelegator.cs

示例7: OnObstacleHit

 public override void OnObstacleHit(PhysX.ControllerObstacleHit hit)
 {
     if (OnObstacleHitCallback != null)
     {
         OnObstacleHitCallback(hit);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:7,代码来源:UserControllerHitReportDelegator.cs

示例8: SetCollisionGroup

        public static void SetCollisionGroup(CollisionGroupFlag group, PhysX.Shape shape)
        {
            PhysX.FilterData newFilterData = CollisionGroup.GetFilterData(shape.SimulationFilterData.Word0,
                shape.SimulationFilterData.Word1, group);

            shape.SimulationFilterData = newFilterData;
            shape.QueryFilterData = newFilterData;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:8,代码来源:CollisionGroup.cs

示例9: CreateBox

        private PhysX.RigidDynamic CreateBox(PhysX.Scene scene, int offset)
        {
            const float HEIGHT = 20.0f;

            var rigid = scene.Physics.CreateRigidDynamic();
            var shape = rigid.CreateShape(new PhysX.BoxGeometry(1.0f, 1.0f, 1.0f), material);
            
            rigid.GlobalPose = PhysX.Math.Matrix.Translation(130f, 130f, HEIGHT + offset);

            return rigid;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:11,代码来源:Form1.cs

示例10: IsRideOnPrim

        private bool IsRideOnPrim(PhysX.Shape shape)
        {
            if (_standingOnPrim == null)
            {
                return false;
            }

            PhysxPrim shapePrim = shape.Actor.UserData as PhysxPrim;

            return IsRideOnPrim(shapePrim);
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:11,代码来源:CharacterRideOnBehavior.cs

示例11: GetBehaviorFlags

 public override PhysX.ControllerBehaviorFlag GetBehaviorFlags(PhysX.Shape shape)
 {
     if (IsRideOnPrim(shape))
     {
         return PhysX.ControllerBehaviorFlag.CctCanRideOnObject;
     }
     else
     {
         return 0;
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:11,代码来源:CharacterRideOnBehavior.cs

示例12: CreateSphere

        private PhysX.RigidDynamic CreateSphere(PhysX.Scene scene, int offset)
        {
            const float HEIGHT = 20.0f;

            var rigid = scene.Physics.CreateRigidDynamic();
            var shape = rigid.CreateShape(new PhysX.SphereGeometry(1.0f), material);

            rigid.GlobalPose = PhysX.Math.Matrix.Translation(128f, 128f, HEIGHT + offset);
            rigid.AngularDamping = 0.2f;
            rigid.LinearDamping = 0.2f;

            return rigid;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:13,代码来源:Form1.cs

示例13: LoadPhysics

		protected override void LoadPhysics(PhysX.Scene scene)
		{
			var material = scene.Physics.CreateMaterial(0.7f, 0.7f, 0.1f);

			var sphereA = scene.Physics.CreateRigidDynamic();
			sphereA.CreateShape(new SphereGeometry(1), material);
			sphereA.GlobalPose = Matrix4x4.CreateTranslation(0, 30, 0);

			scene.AddActor(sphereA);

			//

			var sphereB = scene.Physics.CreateRigidDynamic();
			sphereB.CreateShape(new SphereGeometry(1), material);
			sphereB.GlobalPose = Matrix4x4.CreateTranslation(0, 40, 0);

			scene.AddActor(sphereB);

			//

			var sphereC = scene.Physics.CreateRigidDynamic();
			sphereC.CreateShape(new SphereGeometry(1), material);
			sphereC.GlobalPose = Matrix4x4.CreateTranslation(0, 50, 0);

			scene.AddActor(sphereC);

			_sphereC = sphereC;

			//

			var revoluteABJoint = scene.CreateJoint<RevoluteJoint>(sphereA, Matrix4x4.Identity, sphereB, Matrix4x4.Identity);
			revoluteABJoint.SetGlobalFrame(new Vector3(0, 35, 0), new Vector3(0, 0, 1));
			revoluteABJoint.ConstraintFlag = ConstraintFlag.Visualization;

			var revoluteBCJoint = scene.CreateJoint<RevoluteJoint>(sphereB, Matrix4x4.Identity, sphereC, Matrix4x4.Identity);
			revoluteBCJoint.SetGlobalFrame(new Vector3(0, 45, 0), new Vector3(0, 0, 1));
			revoluteBCJoint.ConstraintFlag = ConstraintFlag.Visualization;

			var revoluteAJoint = scene.CreateJoint<RevoluteJoint>(sphereA, Matrix4x4.Identity, null, Matrix4x4.Identity);
			revoluteAJoint.SetGlobalFrame(new Vector3(0, 30, 0), new Vector3(0, 0, 1));
			revoluteAJoint.ConstraintFlag = ConstraintFlag.Visualization;
		}
开发者ID:flair2005,项目名称:PhysX.Net,代码行数:42,代码来源:DoublePendulumSample.cs

示例14: TryInformPrimOfContactChange

 private bool TryInformPrimOfContactChange(PhysX.ContactPairHeader contactPairHeader, PhysX.ContactPair[] pairs, int actorIndex)
 {
     PhysxPrim prim = contactPairHeader.Actors[actorIndex].UserData as PhysxPrim;
     if (prim != null)
     {
         prim.OnContactChangeSync(contactPairHeader, pairs, actorIndex);
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:13,代码来源:PhysxScene.cs

示例15: SetToRemoveAfterReport

 private void SetToRemoveAfterReport(PhysX.Shape otherShape, PhysxPrim colPrim)
 {
     ExternalReport report;
     if (_externalCollisionReports.TryGetValue(otherShape, out report))
     {
         if (report.Reported)
         {
             //this collision was reported already. remove it
             RemoveExternalCollidingPrimShape(otherShape, colPrim);
         }
         else
         {
             //this collision hasn't been reported yet. make sure the 
             //collision processor knows to remove it after it is reported
             report.RemoveAfterReport = true;
         }
     }
 }
开发者ID:digitalmystic,项目名称:halcyon,代码行数:18,代码来源:PhysxCharacter.cs


注:本文中的PhysX类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。