Line of Sight - Topdown Game

Started by
7 comments, last by haykan648 8 years, 11 months ago

Hello ,

I have Unity3D 4.5 Free installed on my PC and I want to know how to create a LOS (Line Of Sight) in a Top-Down Shooter game.

I have written the algorithm based on this page(mostly). (Casting rays and creating a triangle fan)

This page was also helpful : Line Of Sight In a Tile Based World

Similar Games : Monaco , Gish

-The thing i want to know is what is the best way to implement it in Unity3D.

FOW , Projectors are the only ways that i tried and didn't work(maybe i didn't know how to work with them).

Thank You

Advertisement

Testing line of sight, first google result for code sample of the process.

If you are looking for a lighting style rather than object tests, turn off all ambient lights, make tall objects, and drop in a light.

If you are looking for a lighting style rather than object tests....

I'm looking for both.

Turn off all ambient lights, make tall objects, and drop in a light.

I think have tested that and it wasn't the effect that i was looking for.

- I'm more confused about how to make such an effect (Like the picture attached to the first post) in Unity3D, I'd appreciate it if you helped me to do so,

Take a look at the asset store. Here's a free project with dynamic lighting and shadows:

https://www.assetstore.unity3d.com/en/#!/content/24083

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

I recommend searching for "unity fog of war"



Render your line of sight info to a texture, then use the texture as a mask like is done for fog of war. If you dont want revealed areas to stay revealed, then the texture only needs to cover the viewport and be refreshed every frame.

Take a look at the asset store. Here's a free project with dynamic lighting and shadows:

https://www.assetstore.unity3d.com/en/#!/content/24083

- Eck

Hey Guys,

Thanks to Eck for the asset, i found it pretty convincing and spent a lot of time analyzing it.

BUT It works with meshes.

The Question Is: How can i some how convert it to light ?

As you can see in the picture attached i set ambient light near to black but i want i to be completely dark outside of light of sight and i don't think that i can do it using meshes .

- The next picture is when ambient light is black and the mesh works well. (But i can't see part of the plane that is around the character or in other word when its near the light)

(There is no light in both pictures)

-Should I use another way like FOW ?

-Is there a Way to do it using meshes?

Thanks.

Hey ,

As you can see in the picture i did this LOS Lighting using meshes. Thanks To : forb, Eck , DaveSFwub.png

I just did as the same as the asset Eck gave me did And i created an object and added a mesh to it that is black and this mesh includes vertices that are the 2 edges(The edges that the endpoint of the raycasts are themselves) of the object and their raycast's end in the screen (As you can see in the picture) and i lowered the mesh's height so that the obstacle itself can be seen - I guess that's all.

THANK YOU ALL.

Awesome. Do you see obstacles behind your obstacles?

* | |

If the * is the smiley and |'s are walls, can you see the 2nd wall or is it obscured in shadow?

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

Awesome. Do you see obstacles behind your obstacles?

* | |

If the * is the smiley and |'s are walls, can you see the 2nd wall or is it obscured in shadow?

- Eck

Yes it can.

I will attach the source as soon as it's ready

This topic is closed to new replies.

Advertisement