本文整理汇总了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);
}
}