本文整理汇总了C#中BulletSharp.DiscreteDynamicsWorld.RayTest方法的典型用法代码示例。如果您正苦于以下问题:C# DiscreteDynamicsWorld.RayTest方法的具体用法?C# DiscreteDynamicsWorld.RayTest怎么用?C# DiscreteDynamicsWorld.RayTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BulletSharp.DiscreteDynamicsWorld
的用法示例。
在下文中一共展示了DiscreteDynamicsWorld.RayTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CastRay
/// <summary>
/// Casts a ray downwards from the given kart
/// </summary>
/// <returns>The ray result callback</returns>
private DynamicsWorld.ClosestRayResultCallback CastRay(Kart kart, float rayLength, DiscreteDynamicsWorld world) {
// get a ray pointing downwards from the kart (-Y axis)
Vector3 from = kart.ActualPosition + kart.ActualOrientation.YAxis; // have to move it up a bit
Vector3 to = from - kart.ActualOrientation.YAxis * (rayLength + 1); // add 1 to compensate for the "moving up" we did to the "from" vector
// make our ray
var callback = new DynamicsWorld.ClosestRayResultCallback(from, to);
// we only want the ray to collide with the environment and nothing else
callback.CollisionFilterMask = rayFilterGroup;
world.RayTest(from, to, callback);
#if DEBUG
//MogreDebugDrawer.Singleton.DrawLine(from, to, ColourValue.Red);
#endif
return callback;
}