should behave like the cone in Nox (westwood, year 2000)
i cant find how to implement this feature but its crucial to the gameplay i am aiming at.
-Its mainly what a ~300° radiation angle light source would do (except the not-rendering parts of out of sight enemy ships)
-all the action happens in one Z-plane, so the shadow only needs to be 2 dimensional
-i would be satisfied if the not-rendering parts wont work and i would have to use a deep black shadow to achieve sight blocking
W A S D: Movement
SPACE: Movement Toggle between Arcade/Referential
RightMB: FreeCursor+Splitscreen on Distance, Awsome, TRY IT!
ScrollWheel: Zoom
the camera is a bit Jumpy but who cares yet…
next Step: use mgears VisibilityMesh to Hide/show enemies… ThankYou mgear , never expected to get that far
@Quickfingerz in his recent speech for #Luug, discussing Covert (a runner up in the Flash in a Flash Unity competition) did a brute-force method, by literally raycasting 90 rays over the arc (not a cone really) and joining the dots to draw a procedural poly. It’s ugly but it works. Where multiple cameras were required, he had to reduce the number of rays to keep it scaling, so may not be suitable for large numbers of enemies.
I believe there is a procedural poly maker on the UnifyCommunity Unity Wiki.
The other option that might work for you is to place a spotlight on the character’s head, and assuming you have Unity shadows on, you should achieve a similar effect.
Worth keeping in mind that this is just for the actual visuals. The actual detection can just use a single normal raycast between enemy and player or vice versa to determine if they are actually visible or not.
i admit we are still within the feasability study of this game project, checking if we can implement all features using unity(free ), this is the last issue before we can start.
maybe i can reduce the problem… only raycasting to the edges of the polygons should be enough, also i only need to cast to the edges of the visible geometry… basically i need to solve this with multiple viewing points (share field of sight with allies):
but when i use round obstacles with lot of edges it will slow down big time i guess…
wow, thanks mgear, looks good.
-does the pseudopolygon always have to have a tint? i dont want to distort the colors of the underneath textures. maybe i can add a depth shader to the created mesh to mask things out - like the one i use for dynamic splitscreen… then it should work like a cutout-the-visible-area-polygon. then they would be overlapable as well…
yesterday i started programming until late night (appeared late in office today though). Unity is awsome, i juggled some scripts around and after 6 hours things are already moving and doing what i want .
i even managed to get non rectangular viewports working.
the next biggy is this algorithm… but im faithful
i want to be able to share field of view with allies, its then like a multipoint visibility polygon problem, hopefully this doesnt mess up every approach
man, maybe i can even add some kind of terrain destruction using voxelform2.0
I know this wasn’t about a 3d solution, but I saw several people looking for a ConeCast, so I made one. It’s an extension method to use as Physics.ConeCastAll: