Away3D で簡単な衝突検出を行う必要があります。away3d.bounds.AxisAlignedBoundingBoxクラスを見つけましたが、バウンディング ボックスとベクターの間の衝突しか確認できないようです。
2 つの境界ボックス間の衝突を確認する方法はありますか?
Away3D で簡単な衝突検出を行う必要があります。away3d.bounds.AxisAlignedBoundingBoxクラスを見つけましたが、バウンディング ボックスとベクターの間の衝突しか確認できないようです。
2 つの境界ボックス間の衝突を確認する方法はありますか?
4.4.x を使用している、または 4.4.x にアップグレードできる場合は、Mesh.worldBounds、特に wordBounds.overlap(someOtherWorldBounds) を調べてください。
例 (away3d セットアップを省略):
// setup objects and materials
cubeMaterial:ColorMaterial;
cube:Mesh;
sphereMaterial:ColorMaterial;
sphere:Mesh;
collideMaterial:ColorMaterial;
cubeMaterial = new ColorMaterial(0x3333FF);
cube = new Mesh(new CubeGeometry(), cubeMaterial);
cube.x = -100;
cube.showBounds = true;
sphereMaterial = new ColorMaterial(0xFF3333);
sphere = new Mesh(new SphereGeometry(), sphereMaterial);
sphere.x = 100;
sphere.showBounds = true;
collideMaterial = new ColorMaterial(0x33FF33);
あなたのenterFrameハンドラーで:
// process your object movement here
if (cube.worldBounds.overlaps(sphere.worldBounds) cube.material = collideMaterial;
else cube.material = cubeMaterial;
view.render();