Jump to content

Line of Sight calculations, anybody done those?


willemmulder
 Share

Recommended Posts

For a game, I need many AI units to calculate whether they 'see' each other or not. 

After some googling, I think I might have to go with raycasting and do something like this: http://www.redblobgames.com/articles/visibility/ (great demo BTW!) or even simply cast a ray from every unit to every other unit and check if there's nothing in-between..?

Has somebody already done something similar for babylonjs? Or should I work with a light, let Babylonjs calculate it's shadowmap or something like that?

Link to comment
Share on other sites

It would be easier to work with raycast. It's very easy to do it wih Babylon (of course :) )

Just create a Ray: http://doc.babylonjs.com/classes/2.2/Ray
and use the method scene.pickWithRay : http://doc.babylonjs.com/classes/2.2/Scene#pickwithray-ray-predicate-fastcheck-rarr-pickinginfo-classes-2-2-pickinginfo-

You can find some examples here: http://doc.babylonjs.com/playground?q=pickwithray

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...