Jump to content
  • Advertisement
Sign in to follow this  
VanillaSnake21

C++ Ray-triangle intersection on large meshes is very slow

Recommended Posts

At the moment I'm trying to switch from height-mapped terrain to a model terrain that could be loaded from a file. I'm currently using height-map lookup table to get the height of the terrain at a specific position as a way for the character controller to be able to walk on the terrain, however I'd like to switch to a ray cast method. The current code goes like this>

Create a ray from player position and point it in down direction.

Iterate over every triangle and test if the ray is intersection

Get the height of the triangle at that position

 

The issue is that I have 30,000 triangles in the mesh. I was wondering if there is anything I can do to speed it up, or how is such a system usually implemented (I mean walkable terrain) maybe I shouldn't even be using raycasting? Thanksl.

Edited by VanillaSnake21

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!