Looking for spherical terrain collision alogrithms

Started by
10 comments, last by Jozin 4 years, 6 months ago

I googled for terrain collisions but found only some sources about flat worlds.   I want collision detection for spherical terrain worlds.   I have "3D Engine Design for Virtual Globe" book but it did not mention any algorithms about collision detection for landing, rolling, walking, crashing, etc...   Does anyone have any good sources for spherical terrain collision detection?

Advertisement

Do you use cartesian coordinates and have a spherical object as ground? Or do you use spherical coordinates over a "flat" world?

37 minutes ago, ninnghazad said:

Do you use cartesian coordinates and have a spherical object as ground? Or do you use spherical coordinates over a "flat" world?

I mean spherical terrain object as ground in cartesian (XYZ) coordination for collision detection.

2 Circle checks.

Well in that case basically any collision detection would work. Testing intersection against a sphere is as easy as comparing distance vs radius, when the distance is smaller, there must be a collision.

But you probably don't have only spheres in your game. And your sphere is probably a spherical model made up out of triangles. And the problem with collisions really isn't detection but resolution.

And if you don't know that, you will have a hard time writing that by yourself. 

I'd say use a physics library to detect and resolve collisions. Don't know what language or engine you are working with, but you can find one (free ones even) for almost any language or engine.

For anything but really simple cases writing it yourself is ... insane. And unnecessary.

A few random thoughts:

Taking into account the last threads on this i think we don't have spheres here and in case of the earth a general sphere intersection test can be off by 20km. In extreme cases it could result in mid air collision with terrain 20km above the poles or a subterranean flight below the moho under the equator. Space gamers call the latter "lithobreaking" in extension of "aerobraking" in the upper atmospheres of planets or gas giants ?

If these details matter we need ellipsoid intersection tests for the big overall scale (simple i dare say).

The atmosphere should be taken into account for small body against big body. That can be arbitrarily complex i assume, so further specification is needed. You mentioned spaceflight in another thread. What collides with what ? Spaceships ? Asteroids ? What about atmospheres ? Drag and friction ? Terrain detail ? Orbital speeds ?

A small slow moving body in atmospheric flight (a plane, or anything having slowed down to terminal speed in an atmosphere) must be tested against local terrain i'd think. That would probably result in an intersection test of a bounding shape of the flying contraption against the terrain mesh in the direction of flight.

More ?

I found a book called “Collision Detection” on Amazon and it explains about many different kinds of simple collision detection like AABB, OBB, sphere, etc. in chapter 4.  I will study it more.  Also other books called “Physics Engine” and “Game Engine Architecture”. 

I have books called “Atmospheric and Space Flight Dynamics” and “Orbital Mechanics”  about aerobraking, re-entry, etc.. 

Yes, I mean space plane, space shuttle, and capsule for landing, launching and docking with ISS. 

I now implemented reference frame, orbit and rotation model on planets and stars for orbiting and rotating locally.  I got VSOP 87 and JPL Ephemeris data for planets and P03 precession model for earth rotation.  I implemented follow function in player class to follow any object locally by using reference frame for orbiting, etc.. 

For more tests, I moved earth position to 149.6 million km away from origin. No jitters a few meters above ground! Yay! 

Hi if you want code (my game engine made during PhD):

https://github.com/g-amador/JOT/tree/master/engine/Core-Toolkit-Components/src/main/java/jot/math/geometry/bounding

isCollide method in either bounding object.

Just find an intersection with flat ground, any algorithm (distance functions,  maxmip pyramid, csm) is valid,  but transform (rotate) the bound box before finding ray-box intersection (vertex shader), then transform your ray into local bbox coordinates and voila, you get it!

This is an example of my 3 years old raycasting work made during my PhD))

 https://www.youtube.com/playlist?list=PLipolsnVA6o00WdwVmk8wlQz6FuAa-btI

As you can see the method is robust butit need to be heavy optimized to use in real time engines

Jeronimo!

On 10/23/2019 at 1:53 PM, Jozin said:

Just find an intersection with flat ground, any algorithm (distance functions,  maxmip pyramid, csm) is valid,  but transform (rotate) the bound box before finding ray-box intersection (vertex shader), then transform your ray into local bbox coordinates and voila, you get it!

This is an example of my 3 years old raycasting work made during my PhD))

 https://www.youtube.com/playlist?list=PLipolsnVA6o00WdwVmk8wlQz6FuAa-btI

As you can see the method is robust butit need to be heavy optimized to use in real time engines

Interesting.  Where is Heli Engine?  That did not provide any information but just video clips.

Well, I found a book called "Physics Engine" book provides a lot of information about collision detection. I recommend two books - "Collision Detection" and "Physics Engine" for collision detection.  I think that they explains  can detect collision when hit a rendered tile.

This topic is closed to new replies.

Advertisement