aWeirdo Posted October 22, 2016 Share Posted October 22, 2016 Hi all, I know it isn't really babylon related, but there are a lot of smart guys around so i believe it to be worth a try and ask I have been working on & testing some area calculations, mainly for finding meshes within a certain select area, think "area of effect" game abilities. Examples; For a square area, I simply use two vector3's, one containing minX, minZ and the other one containing maxX and maxZ, thus creating a virtual square which you can use to check if any meshes are found within it. Resulting in a very lightweight & simple solution. For a circular area, I use a starting middel point of the circle (x & z position), and a pre-set radius/distance value and then i calculate & check distance to meshes and select all meshes which are valid and in-range, But now to the issue at hand, Finding a cone area; Basicly, a small select part of a circle area, calculated depending on a player's rotation.y, a pre-set radius/distance value and a pre-set "width" value. Visualization; So in the above visualization, if a mesh was found within the cone area shown in the "width" illustration, it should be a hit, but if it was outside the defined area, it should be ignored, even if the mesh is within the circles radius.. How would you go about doing this? I have setup a PG containing the basic circular calculations, (open browser console for code feeback). http://www.babylonjs-playground.com/#2KMFW6#5 I appreciate any help & ideas.. Cheers. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.