Oct
29
2012

2D Raycasting Visibility – Voxel Travelsal

Converted this AS3 2D raycast (by Lee Grey) to Unity javascript. (Image: raycast is coming from the middle, hits a wall..)

Next:
– Use grid array instead of reading pixels from image.. (done)
– Try if this is faster compared to the old Raycast visibility code (done)
– And would this ever work with moving objects..?
– 3D version needed for Voxel Terrain digging (mesh collider is too slow)

Some results:
– v2.0: 50000 rays, mainthread: ~40ms (using 2D grid map) vs. old real raycast ~68ms

Added version 2.0 webplayer:
– Calculates 512 rays for visibility with voxel travelsal.

Webplayer:
http://unitycoder.com/upload/demos/VoxelTravelsal2DRaycasting1/
(v1.0)
http://unitycoder.com/upload/demos/VoxelTravelsal2DRaycasting2/ (v2.0)

Download source:
voxelTravelsal1.unityPackage
voxelTravelsal2.unityPackage


11 Comments + Add Comment

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.