Jump to content


Collision detection......


1 reply to this topic

#1 SYS49152

    Member

  • Members
  • PipPip
  • 57 posts

Posted 31 December 2004 - 08:58 AM

hello all....

i have atm my terrain as a simply layer and combined with real data that was created in a modelling programm for mountains.

something like this:

http://www.netpix.or.../04/mount01.jpg

the player should be able to run on the mountains.
so i wonder what kind of collision detection normaly people implement for this kind of data.

my first attempt is to scan the object. i have a simply copy of the modell in memory. but if the mountains get more complex more time is needed to find the triangle the player is on.

i have 2 ideas atm but i dont know if someone would do this way.

1. divide the modell in different parts. ( somekind of patches ) inside the modelling programm and then save as single modells.

2. using an octree for the modell ( mountains )

- Andy

#2 Smokey`

    New Member

  • Members
  • PipPip
  • 25 posts

Posted 13 January 2005 - 12:51 PM

The simplest and cheapest way if you just want the player to be able to walk on the terrain would be to find what triangle the player is on, given their x/z coordinates. (If your terrain is simply a uniform grid, this should be quite trivial)

Then given the distance between the triangles point's and the player's position, LERP between the three points of the triangle. This will give you the point on the terrain where the user should be...

However if the terrain overlaps itself in some cases (eg: caves...), or you want more complex physics, you'd best go the whole way and implement some rigid body dynamics...

I hope this helped... :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users