Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12046 Posts in 1593 Topics- by 595 Members - Latest Member: KeelmHaxabefe

22. May 2013, 03:51:00 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Terrain Following with picking
Pages: [1]
Print
Author Topic: Terrain Following with picking  (Read 775 times)
maguila007
Enjoying the stay
*
Offline Offline

Posts: 43



View Profile Email
« on: 16. October 2007, 02:01:17 pm »

Hi

I am planning to do my own Ray3f impl for terraing following using picking. I need to test the terrain height each time the user moves.
I will not do picking with the hole terrain, all the time, it´s subdivided by sections, so I will only pick over the current section.
Is there a better way?


I also need collision detection with the terrain, but I read it should be better to use JOODE´s collision engine, isn´t it?

Thanks.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 16. October 2007, 04:50:46 pm »

I am planning to do my own Ray3f impl for terraing following using picking. I need to test the terrain height each time the user moves.
I will not do picking with the hole terrain, all the time, it´s subdivided by sections, so I will only pick over the current section.
Is there a better way?

Yes, there definitely is a better way. You could directly use the Terrain's HeightMap. Any heightmap implementation will have the possibility to query the height value for a given x,y coordinate pair in O(1) time. (That's waht a heightmap actually does Wink.) Even Bezier planes provide this possibility. If your solution you would have O(n) times, where n is the polygon count of a patch. AND an n-th of these n steps will be more expensive than the one step of the O(1) for the HeightMap.

So, you should find out, how to query the height value for a given x,y coordinate pair in your terrain implementation.

I also need collision detection with the terrain, but I read it should be better to use JOODE´s collision engine, isn´t it?

It certainly is. JOODE is impressively fast. Don't know, if there is an XPAL abstraction for that. If not, it should be added.

Marvin
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #2 on: 16. October 2007, 07:10:59 pm »

Quote
(...)You could directly use the Terrain's HeightMap.(...)
If you are using my terrain implementation in the xith codebase, you can use the GridSampler for this purpose. Integration into XPAL/JOODE is planned, so if you are interested to dive into this, raise a hand Wink

Logged

maguila007
Enjoying the stay
*
Offline Offline

Posts: 43



View Profile Email
« Reply #3 on: 17. October 2007, 11:15:48 am »

Quote
You could directly use the Terrain's HeightMap
Ok, that´s a good idea. So if I use HeightMaps, It seems I can solve Terrain Following. And I think I can solve collision detection too(with terrain). I can see the next height if it is too high, it´s a collision.
So HeightMaps seems to be a really good solution for Terrain Following and Collision Detection in external scenaries.


What I really don´t know is how to do Terrain Following in an internal scenarie, like a Quake 2's level. I can check simple bounds all the time (like spheres and boxes) to solve Collision detection but how do I find the correct height?
Does Quake 2 use picking for that?



Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #4 on: 17. October 2007, 11:20:55 am »

You maybe want to have a look at the BSPLoaderTest. There's collision detection enabled and even simple simulation (gravity). It is currently using AABBs. But can also be done with TriMeshes.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic