我不是关于如何设置这个了,我需要在这种情况下,盒子而不是球,因为我想知道,如果激光在我的3D场景击中敌舰清楚。这里是我的球体代码,我将如何将其更改为包围盒。因为如果我使用球体进行激光处理,那么即使球体距离实际激光很远,球体也会很大并撞上一艘船。所有即时通讯问我是如何去设置这种方式的边界框。边框碰撞XNA C#
private bool Cannonfire(Model model1, Vector3 world1, Model model2, Vector3 world2)
{
for (int meshIndex1 = 0; meshIndex1 < model1.Meshes.Count; meshIndex1++)
{
BoundingSphere sphere1 = model1.Meshes[meshIndex1].BoundingSphere;
sphere1.Center = world1;
for (int meshIndex2 = 0; meshIndex2 < model2.Meshes.Count; meshIndex2++)
{
BoundingSphere sphere2 = model2.Meshes[meshIndex2].BoundingSphere;
sphere2.Center = world2;
if (sphere1.Intersects(sphere2))
return true;
}
}
return false;
}
那么我该如何感谢任何帮助。
我想我可以做这个工作谢谢! – QuantumArchi 2013-03-04 16:03:32