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


C# MyPhysicsBody.WorldToCluster方法代码示例

本文整理汇总了C#中Sandbox.Engine.Physics.MyPhysicsBody.WorldToCluster方法的典型用法代码示例。如果您正苦于以下问题:C# MyPhysicsBody.WorldToCluster方法的具体用法?C# MyPhysicsBody.WorldToCluster怎么用?C# MyPhysicsBody.WorldToCluster使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sandbox.Engine.Physics.MyPhysicsBody的用法示例。


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

示例1: TriggerDestruction

        public static void TriggerDestruction(float destructionImpact, MyPhysicsBody body, Vector3D position, Vector3 normal, float maxDestructionRadius)
        {
            if (body.BreakableBody != null)
            {
                float collidingMass = body.Mass;// == 0 ? Mass : body.Mass; //fall on voxel
                float destructionRadius = Math.Min(destructionImpact / 8000, maxDestructionRadius);
                float destructionImpulse = MyDestructionConstants.STRENGTH + destructionImpact / 10000;
                float expandVelocity = Math.Min(destructionImpact / 10000, 3);

                MyPhysics.FractureImpactDetails destruction;
                HkdFractureImpactDetails details;
                details = HkdFractureImpactDetails.Create();
                details.SetBreakingBody(body.RigidBody);
                details.SetContactPoint(body.WorldToCluster(position));
                details.SetDestructionRadius(destructionRadius);
                details.SetBreakingImpulse(destructionImpulse);
                details.SetParticleExpandVelocity(expandVelocity);
                //details.SetParticleVelocity(contactVelocity);
                details.SetParticlePosition(body.WorldToCluster(position - normal * 0.25f));
                details.SetParticleMass(10000000);//collidingMass);
                details.ZeroCollidingParticleVelocity();
                details.Flag = details.Flag | HkdFractureImpactDetails.Flags.FLAG_DONT_RECURSE | HkdFractureImpactDetails.Flags.FLAG_TRIGGERED_DESTRUCTION;

                destruction = new MyPhysics.FractureImpactDetails();
                destruction.Details = details;
                destruction.World = body.HavokWorld;
                destruction.ContactInWorld = position;
                destruction.Entity = (MyEntity)body.Entity;

                MyPhysics.EnqueueDestruction(destruction);
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:32,代码来源:MyDestructionHelper.cs


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