See site in english Voir le site en francais
Website skin:
home  download  forum  link  contact

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Author Topic: Collision detection..well not exactly  (Read 4925 times)

0 Members and 1 Guest are viewing this topic.

Offline harmsway

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: 0
03 June 2004, 15:22:01
Hey Dan,

A thread in the main forum got me to thinking about this topic. If OrbiterSound can detect distance to target and
initiate a beep sound and if OrbiterSound can detect when a ship is docked to initiate the docking clank-clunk-thud-
thud-thud sound........Why not a collision sound and alarm when distance to docking port runs into negative
numbers? :sunk:

Only I'm not sure it ever goes negative the numbers may just start climbing back up again as the ship passes
through. Anyway I'm sure there is a way to detect a "missed" docking.

What do you think. Is this something OrbiterSound could do?

Gene


Offline DocHoliday

  • Legend
  • ******
  • Posts: 2475
  • Karma: 2
Reply #1 - 03 June 2004, 15:59:12
Good idea to start with but to add a little.

I think you could solve that by subtracting the dock distance from total distance (the one measured by AE35). Now
the logic goes like this:
total distance positive > dock distance = approaching
total distance = dock distance = dock (if speed is too high, you will continue and the next condition becomes TRUE)
total distance < dock distance = crash

One problem though.. the VECTORS from DG to ISS central point and DG to docking port must overlap (what's the
word, be on top of eachother?). If one vector is off the measured distance cannot be simply subtracted, because it
would yield an incorrect difference... It would involve sine functions.. And that whole vector business is probably a
notch tougher to programme.

I'd assume :)


~~~

"Mood is a matter of choice. I choose to have fun!" -Vidmarism No 15

Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #2 - 03 June 2004, 17:58:58
OrbiterSound calculate the distance to the center of the ship (because Orbiter
don't give us distance to docking port)  the "clank" sound is played because Orbiter
give us a callback when a ship dock.

So collision with only distance to the center of the mesh
is called "bounding sphere" collision detection and is the worse system that we might
apply. If all ship or station where plain round it would work perfectly but as they have really
different shape it will not work giving you false collision about every time.



On the iss if we set the distance to very low (light green) you can see on the 1st pic that
you can collide with 70% of the station without any warning, if we set it very
fare you will not be able to dock without colliding and also you cannot even approach
in the emtpy space beetween the solar panel and the body.

Same apply for vessel on the lower pic. light green= no collision most of time
dark green you will have false collision if you side with any other object.

There is no simple solution for collision detection, daver whent with one module
that do that, but it have a performance cost.

Dan



Post Edited ( 06-03-04 18:27 )


Offline harmsway

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: 0
Reply #3 - 03 June 2004, 20:31:57
Yes, I thought of all that. That's why I was speaking of the docking port only, not collision into any part of the ship.
What I didn't know was that Orbiter gave a callback on ship dock.

However I still got to ask. The DockMFD does give distance to docking port doesn't it?  Not the center of target ship.
So if the DockMFD can read speed and distance to port isn't there a way to tell when you pass through.

For example: <1m at >0.10m/s collision sound

Anyway after all this thought I must say this. This would be one feature I would never use. I can't remember the last
time I goof up a docking.

Gene


Offline daver

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Reply #4 - 03 June 2004, 20:45:30
There is no simple solution for collision detection, daver whent with one module
that do that, but it have a performance cost.


 Really? The performance overhead should be very low as the module only does the sphere check you descrbe above. All
that happens is that a compliant vessel, if one is found, has its "OnCollision" event handler called.

 I designed it this way so that only the possibility of collision is flagged to the colliding vessels, I have left it up to
the programmer to implement more complext geometry tests, although I have found and included some public domain fast triangle
intersection tests.

 Anyhow during my own tests I was unable to determine if there was any change in framerate whilst only the detection engine
was operating.


 Of course that doesnt stop some clown from filling the OnCollision handler with slow junk , but thats beyond my remit :P

Cheers

Dave



Post Edited ( 06-03-04 20:46 )


Offline schumanna

  • Full Member
  • ***
  • Posts: 156
  • Karma: 0
Reply #5 - 03 June 2004, 20:53:46
If something gets to close to you and you are going to fast towoards a ship then a voice comes.
"We are all going to die, nooooooooooo" :)



Post Edited ( 06-03-04 21:25 )

Owner of Astroide Chiron and Alpha Centaury

"Just because I don't care doesn't mean I don't understand". quoting Homer Simpson

Du & Ich...(Orbiter)...heißt, niemals alleine zu sein

Offline AphelionHellion

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 0
Reply #6 - 03 June 2004, 20:58:32
*clueless*
I know I'm not the most knowledgable on this subject, but I am a veteran of far too many 3-D games, most of which
seem to have pretty decent collision detection. I know that plane-for-plane vertex-for-vertex collision detection is a
very intensive process, but what about just a few localized bounding boxes?
In games involving gunfire (again, of which I am far too familiar) each person's player model typically has a number of
bounding boxes surrounding various parts of the body - upper arm, lower arm, upper leg, lower leg, pelvis, torso,
neck, head. This lets you get winged in the leg and be forced to limp along (or hit in the head and killed instantly).
Heh... *recovering Half Life addict*
 
Would it be that computationally intensive to have a rectangular bounding box for each module of the ISS? It wouldn't
be perfect, but it'd be pretty reasonable for most purposes. I mean, it's not like in real life the ISS regularly has ships
threading the needle between modules and solar panels, especially after that incident with MIR :)

< [yellow]C[/yellow]arpe [yellow]N[/yellow]octem! >

Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #7 - 03 June 2004, 21:29:02
Quote
daver wrote:
 Really? The performance overhead should be very low as the module only does the sphere check you descrbe
above. All
that happens is that a compliant vessel, if one is found, has its "OnCollision" event handler called.
Dave

Ah, sorry I never tried it and I thought you where doing mesh collide test not only bounding sphere.
the simplest/faster would be bounding box tree collide detection but still this isn't very simple to implement.
Any idea daver ? somes projects ?

Dan


Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #8 - 03 June 2004, 21:31:07
Quote
schumanna wrote:
"We are all going to die, nooooooooooo" :)

As this sentence is true at any moment for all of us I can make it play looped in OrbiterSound,
would be faster to program than collision detection :)

Dan


Offline freespace2dotcom

  • Legend
  • ******
  • Posts: 2251
  • Karma: 1
Reply #9 - 03 June 2004, 21:06:10
I agree with Aphellion.  I would argue that a few boxes would be ok, but If you can do just a few, than a few more
than that shouldn't be that hard to do. but then, it wouldn't look good if you crashed with the ISS if you were still a
bit away from it (remember docking needs to be more exact than that. can't crash into it a few feet away from even
touching it during a dock. I say just pop in some simple mesh detection. I'm not very familiar with it, but certainly it
can't be that hard. I myself would be one of those who would fly between said solar panels and modules.

(Freespace is planning to get a good whoopin' by all those who do know full well how hard it is to implement what he
asks.)



Offline DanSteph

  • Administrator
  • Legend
  • *****
  • Posts: 15410
  • Karma: 266
  • Hein, quoi !?
    • FsPassengers
Reply #10 - 03 June 2004, 21:42:42
Anyway as Gene I hardly can remind the last time I missed my docking, what
I find really more annoying is the litle jump that you make when docking,
seeing a vessel of several ton make such jump really brake the immersion immo.

I'll submit this to martin, perhaps reducing a bit the distance when it glue ?

Dan


Offline johnc

  • Jr. Member
  • **
  • Posts: 30
  • Karma: 0
Reply #11 - 04 June 2004, 00:21:25
I found a collission detection library that looks like it works of off meshes. I'm not really sure.


the website is: http://photoneffect.com/coldet/


might be intersetong to try to make a module implementing this.


Johnc


« Last Edit: 04 June 2004, 02:38:01 by johnc »

Offline AphelionHellion

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 0
Reply #12 - 04 June 2004, 02:38:01
Hehehe Freespace  :) Hotdoggin' it and scaring the crew, eh?  8o
Still I'd think a relatively simple bounding box system for most of the station and then a more precise system for the
docking ports themselves would make sense.
We don't need things to be totally realistic in all situations, just the ones that you find yourself in 95% of the time.
After all, this is why Orbiter's surface textures look really awful from near the ground unless you have a hi-res tile set
like Edward's or southern Italy or of course KSC. And even those look pretty bad from right on the surface. 95% of the
time you're not supposed to be anywhere near the ground, anyway! ;)

Dan: That reminds me, I've been meaning to read up on how exactly docking latches work IRL. If anyone has any good
links for us, please post 'em!

It was my understanding that there is a sort of "funnel" device that ensures that if the approaching ship is off by a few
inches in any direction, the ship (and its docking port) "slides in" to the correct position. If this could be implemented
it'd look really cool!
Understandably though it'd be a bit challenging to program, I'd think. Sort of like an autopilot without using the jets.
There would need to be a very precise force applied to the ship.
But hey, if ANYone can do it, Dan, you can!

*shameless brown-noser*  :)

« Last Edit: 04 June 2004, 02:38:01 by AphelionHellion »
< [yellow]C[/yellow]arpe [yellow]N[/yellow]octem! >