Jump to content

  • Log In with Google      Sign In   
  • Create Account





Terrain picking solved

Posted by CC Ricers, 28 March 2013 · 723 views

Guess I spoke too soon about wondering how to go about picking parts of the terrain, because I figured it out! As I'm going to be using BEPU for the physics engine, I just let BEPU do the dirty work. Using it to create a terrain height field and doing ray intersection testing is pretty intuitive. Storing 4 million points is no problem for it, but I may look into its source code to see how it's doing the intersection tests so efficiently.

In the meantime, though, I can move on to creating the brush and mesh placement tools. Mesh placement should be easy, as I want most objects to be touching the ground. Placing meshes will also be treated as brushes so you can fill the landscape with loads of objects quickly. For now I have this video as a proof of concept for testing.

http://www.youtube.com/watch?v=PtdvMMd4JUo

Some ideas on the placement tools:
- Mesh brushes will likely be done the way of Poisson Disk sampling as demonstrated here, so the spacing of objects looks natural and you don't have to think much about how their placement looks.
- Objects can still be changed individually if you wish. A single Selection tool will make it possible to change an object's scaling and location.
- Rotation can be done on a basis of either having all objects orient towards the surface normal, or ignore the Y component. Rocks, for example are fine for rotating in all directions, but trees and buildings should generally point up.
- A toggle switch for each object so you can snap its vertical position to the ground surface in one click.

Physical interactions with the objects will come a bit later. I will at least need a wrapper class to associate mesh instances with BEPU Entities.




Impressive. Your stuff looks better and better. I really need to look into a physics / collision layer, too, self rolled is just too tedious. Recently I even found a .NET wrapper for Bullet (here), which looks compatible to several managed layers (XNA, SharpDX, SlimDX). Though with BEPU I like the idea it's C#. You make me reconsider ;)

October 2014 »

S M T W T F S
   1234
567891011
12131415161718
1920 21 22232425
262728293031 
PARTNERS