本文整理汇总了C#中VRage.Game.Entity.MyEntity.GetPhysicsBody方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.GetPhysicsBody方法的具体用法?C# MyEntity.GetPhysicsBody怎么用?C# MyEntity.GetPhysicsBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRage.Game.Entity.MyEntity
的用法示例。
在下文中一共展示了MyEntity.GetPhysicsBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertiesFromEntity
bool GetPropertiesFromEntity(MyEntity entity,ref Vector3D position1, out Quaternion rotation2, out Vector3 posDiff, out HkShape? shape2)
{
rotation2 = new Quaternion();
posDiff = Vector3.Zero;
shape2 = null;
if (entity.Physics == null || !entity.Physics.Enabled)
{
return false;
}
if (entity.Physics.RigidBody != null)
{
shape2 = entity.Physics.RigidBody.GetShape();
var worldMatrix = entity.WorldMatrix;
rotation2 = Quaternion.CreateFromForwardUp(worldMatrix.Forward, worldMatrix.Up);
posDiff = entity.PositionComp.GetPosition() - position1;
if (entity is MyVoxelBase)
{
var voxel = entity as MyVoxelBase;
posDiff -= voxel.Size / 2;
}
}
else if (entity.GetPhysicsBody().CharacterProxy != null)
{
shape2 = entity.GetPhysicsBody().CharacterProxy.GetShape();
var worldMatrix = entity.WorldMatrix;
rotation2 = Quaternion.CreateFromForwardUp(worldMatrix.Forward, worldMatrix.Up);
posDiff = entity.PositionComp.GetPosition() - position1;
}
else
{
return false;
}
return true;
}