Jump to content

  • Log In with Google      Sign In   
  • Create Account


Landscape Collision detection


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 nvdmerwe   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 August 2001 - 10:16 PM

Now that the terrain is finished I need to put characters on it. The problem is I have no idea how get them to walk around on this kind of surface. As the x and y positions change the z has to change according to the height at those points. What kind of approach can I use? and can I use the same thing for camera collision detection.

Sponsor:

#2 Shannon Barber   Moderators   -  Reputation: 1355

Like
Likes
Like

Posted 04 August 2001 - 09:42 AM

Though I have very limited knowledge of them, I think a BSP trees can be used to do CD efficently on terrain.



Magmai Kai Holmlor
- Not For Rent

#3 TerranFury   Members   -  Reputation: 142

Like
Likes
Like

Posted 07 August 2001 - 07:56 AM

I''m assuming you''re using a heightmap? I''ll say it''s a 2d array (change it to whatever data structure you want).

z = (map[(int)x][(int)y] * (1 - (x - (int)x)) + map[(int)x + 1][(int)y] * (x - (int)x)) * (1 - (y - (int)y)) + (map[(int)x][(int)y + 1] * (1 - (x - (int)x)) + map[(int)x + 1][(int)y + 1] * (x - (int)x)) * (y - (int)y)

That can be optimized a LOT.

If I''ve made a mistake in there (I often do) someone please correct me!

#4 nvdmerwe   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 August 2001 - 10:53 AM

It took me a few minutes but the formula makes perfect sense now. Thanks.

I''m actually using an imported mesh, but I think it could be modified without too much trouble.

Another thought I had was too use the the whole ''map'' datastructure and fit it on an approximated polynomial function. That way you could feed the function the x and y values and just get the z-value at those points.
This would give you the approximated z-value in one go.

Can someone tell me if this sounds like a valid method and/or if someone is using something similar.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS