本文整理汇总了C#中Vehicle.GetBonePosition方法的典型用法代码示例。如果您正苦于以下问题:C# Vehicle.GetBonePosition方法的具体用法?C# Vehicle.GetBonePosition怎么用?C# Vehicle.GetBonePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle.GetBonePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLightOffsetFor
private static Vector3 GetLightOffsetFor(Vehicle vehicle, VehicleLight light)
{
string lightBoneName = GetBoneNameForLight(light);
if (lightBoneName == null)
throw new ArgumentOutOfRangeException(nameof(light));
Vector3 offset = Vector3.Zero;
Vector3 boneWorldPos = vehicle.HasBone(lightBoneName) ? vehicle.GetBonePosition(lightBoneName) : Vector3.Zero;
// if a light is broken it returns a position Vector3 near Vector3.Zero, if so get an approximate offset
if (Vector3.DistanceSquared(boneWorldPos, Vector3.Zero) < 1.25f * 1.25f)
{
string lightName = light.ToString().ToLower();
// left or right
Vector3 posOffset1 = vehicle.GetPositionOffset(lightName.Contains("left") ? vehicle.LeftPosition : vehicle.RightPosition);
// front or rear
Vector3 posOffset2 = vehicle.GetPositionOffset(lightName.Contains("headlight") ? vehicle.FrontPosition : vehicle.RearPosition);
offset = new Vector3(posOffset1.X, posOffset2.Y, posOffset2.Z);
}
else
{
offset = vehicle.GetPositionOffset(boneWorldPos);
}
return offset;
}