Field Of View 2D Based On Ray Tracing | Free Package

Field Of View 2D allows to create visually represented fields of view for AI units.

An approach for this 2D field of view based on ray tracing and may not be efficient if there will be more than 10 instances on a screen at once. But it may be ideal for small games and prototypes.

Look at:
Sample
FOV2D with “AI” and Mecanim

Download Package

PS
If you have some questions or need a developer for hire write me on dima.kurilchenko@gmail.com or skype: dima.kurilchenko

2 Likes

Looks cool, generous offer! :slight_smile:

Looks great! Very generous too, as Maddox says. Thanks!

This is very good lookin.
Can I use it on commercial component?

Thank you all! I hope this package would be helpful at some point in your projects.

Yes, you are welcome to use it on a commercial component and feel free to modify it as you like.

That’s great,

Much appreciated

Dan

You are welcome, Dan.

Actually, if someone needs to implement this, you know, make it more efficient or some customization, you can always contact me:
dima.kurilchenko@gmail.com
skype: dima.kurilchenko
I am working as a freelance developer and looking for interesting projects.

Hey Dima,
Is this your product?

No, it is not mine, but yeah it looks pretty similar to mine, it is also based on ray tracing and a vision cone represented by a mesh, as I can see in a live-demo: http://www.sparkpluggames.com/spgtools_visioncone.htm

Thanks a lot fo this! I will certainly use it in my prototype
Kudos!

Excellent work! Exactly what I needed to test a prototype I’m working on.

One (hopefully small) question: If I set the FOV Angle to 360, it leaves one segment ‘open’ as if it didn’t join the first and last tri to create the final one. Is this an easy edit? Please forgive the newbie-ness.

Thanks again!

Sorry to bother with such a simple question. After a few minutes of fiddling I figured it out. Just needed to add an extra ray.

For others, to get a 360 mesh with the last missing triangle, change the following in FOV2DEyes.cs in the CastRays function:

to

Thanks again!

Thanks again for this awesome Script Dima !

I would like to ask you a question.

Currently the angle of view is like that (360 degres on a plane) :

Is it possible to easily change the angle of the rays in order to project them like a cone ? like that :

Thanks in advance for your answer :slight_smile:

In order to change the angle of the rays and project them as a cone you can do these:

  1. Find a CastRays method in a FOV2DEyes class.

  2. Replace following:

direction = Quaternion.AngleAxis(currentAngle, transform.up) * transform.forward;

with

Vector3 lift = Vector3.up * 0.75f;			
direction = Quaternion.AngleAxis(currentAngle, transform.up) * transform.forward + lift;

At this point you will have a cone like this:
1327528--63508--$lSjxX2C.png
One problem is that the mesh doesn’t has polygons at the bottom in the current FOV2D thing.
1327528--63509--$WbWp8Rr.png

  1. In order to make a two sided mesh you should make changes in a UpdateMesh method in a FOV2DVisionCone class. Basically it means that there would be 2x more vertices (and faces) where a second half would represent a bottom. Remeber: a clockwise order goes for upper faces and a counter-clockwise goes for back faces.

Thanks Dima !

It works perfectly ! you’re awesome :smile:

Hey man! this is amazing! Thanks a lot! I’ve wanted this for my whole live :stuck_out_tongue_winking_eye:

Are there any similar for unity 2D? Thanks

HI Dima Kurilchenko … this package is very usefull.
I this reference to make a 3dFOV. 1865445--119761--Ref-3dEyes.png

1 Like

Great! How does it work?

Woah, thanks you man, you’re great!