OHM Basic Collision Detection

OrbitHangar

Addon Comments
Joined
Apr 9, 2008
Messages
3,832
Reaction score
18
Points
0

Author: virii2k

This is basic collision detection with source.
I wont be updating it so maybe someone can use it.
There are some bugs but, this isnt a finished project.

DOWNLOAD
 
The collision system isn't sphere based, it's collision box based. The geometry can be manipulated to a degree for detection, however, it's based on the name of the ship. Any vessel that has a name that starts with "SH-" is assumed to be a ShuttleA and get a collision box of 3 by 10 by 17.5 meters. Other vessels get other box dimensions. There also seems to be no energy loss in collisions. Quite a few bugs, with vessels getting stuck one in another.

There might also be problems with docking, in cases where the docking port is inside the collision box.

The source code was supposed to be included, but instead, the entire OrbiterSDK folder is included...
Inside the archive's OrbiterSDK\samples\Collision detection are two files, CustomMFD.h and CustomMFD.cpp which contain the source code for the addon.
 
That's an idea I had for some time, but I always feared about the framerate impact (scanning all the vessels of the simuation each frame).
 
That's an idea I had for some time, but I always feared about the framerate impact (scanning all the vessels of the simuation each frame).

OBSP currently has a simple collision detection, where the vessel's size parameter is used as a collision sphere. It gives no performance impact whatsoever...
 
By the description I added, i didnt think anyone would think its a finished project.
I thought maybe another addon developer might be able to work with it and make it something better.
I thought about using oapiGetSize for the "collision box" but for some, if not most vehicles ie. ShuttleA, space shuttle, any rocket, a spherical collision detection based on a mean radius wouldnt work very well at all.
 
Did this add-on already "disappear" from OH?
I've downloaded it from there earlier today, but now it looks it's not there anymore...

BEFORE
Sg7wF.jpg


NOW
BY5lB.jpg
 
Last edited:
Did this add-on already "disappear" from OH?
I've downloaded it from there earlier today, but now it looks it's not there anymore...

Nope,still there.
Nice idea,hope someone take it and make it fully functional add-on.
 
By the description I added, i didnt think anyone would think its a finished project.
I thought maybe another addon developer might be able to work with it and make it something better.

Actually, as a result of your addon, OBSP will improve the collision detection ;)
 
I guess than bounding boxes are possible, since DanSteph did define "cubic" areas for EVA egress in uMMu. From there, adding cubes to cubes, it should be possible to make collision models more satisfying than a bounding sphere.

However, the perfect solution is probably to search in the Graphics Clients area (in order to get meshes vertices coordinates, and calculate accurate collision models).
 
However, the perfect solution is probably to search in the Graphics Clients area (in order to get meshes vertices coordinates, and calculate accurate collision models).

A fast and neat solution is to approximate the collision model of any shape with many spheres.
 
However, the perfect solution is probably to search in the Graphics Clients area (in order to get meshes vertices coordinates, and calculate accurate collision models).

That's actually the worst possible solution. Or should I rather say demanding the most computation cycles, thus never used in aplications like games, and Orbiter is definitely a game :).
 
I think to improve on accuracy, more then one "box" could be defined for each vessel.

collision.jpg
 
Did this add-on already "disappear" from OH?
I've downloaded it from there earlier today, but now it looks it's not there anymore...
If it had disappeared from OHM, you wouldn't be able to post your comment. :P

BEFORE
Sg7wF.jpg


NOW
BY5lB.jpg
Nothing has changed. It's still this way (only different random add-on is being displayed at the top).

If you enter inside any of the add-ons, it's listed in "Newest Uploads". If you visit the home page of OHM, it isn't listed. What you see is most likely a bug on the home page (and a couple of other pages) of OHM, not listing the last uploaded add-on. :shrug:
 
I think to improve on accuracy, more then one "box" could be defined for each vessel.

collision.jpg
I think the best way to improve accuracy is to make several kinds of collision volumes like these
1.bounding sphere/box for entire vessel
2.bounding sphere/box for each mesh
3.bounding sphere/box for each mesh group of every mesh
It can be implemented in that way: module loads mesh data by VESSL::CopyMeshFromTemplate or something else and then finds bounding boxes(or bounding spheres) for all mesh groups (one vessel can have hundreds of mesh groups), then bounding boxes for each mesh and finally one bounding box for the vessel. So when you want to find out which vessels can collide you first process vessel bounding boxes, then mesh BB, then mesh group BB, and then may be process vertex data of 2 colliding mesh groups and find out surface normal and position where they collided. Last step is of course most difficult and computationally expensive. Though I think that simple and fast bounding sphere/box collision will be enough for Orbiter.

But it doesn't solve problems with collision detection and Orbiter like docking ports, rockets on launch pads or attached vessels.:)
 
I think to improve on accuracy, more then one "box" could be defined for each vessel.

Maybe it is possible to define more complex solids with an appropriated system of coordinates ? Like "thick triangles" (sorry I don't know the english word) for the wings and other non-flat surfaces (nose and aft).

The spheres idea is interesting, though I guess it would take a real lot of them.
 
Hi all. Good work virii :thumbup:
But a little question: Shouldn't vessels be rotating after collisions instad of bouncing off? Like in this mysterious great video:

:hailprobe:
 
That rotation would be good. The way it is now, the vessel being hit just inherits direction from the other vessel.
 
Maybe it is possible to define more complex solids with an appropriated system of coordinates ?

Collision meshes are a really old way to solve the problem. You can do the bounding box in any 3d program. If I'd try a collision detection, the first thing I'd try is to use the standard .msh format for this task.
 
Back
Top