gcode-mirror / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

Collision Detection #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Enable CD between camera+building and 3D objects+buildings(milktruck example)

Requested by: benjamin m brown (benjaminbb)

Supported by: undefined

Original issue reported on code.google.com by api.roman.public@gmail.com on 12 Aug 2008 at 8:46

GoogleCodeExporter commented 9 years ago
Why not use hit testing. See GEView GEHitTestResult
It is a primitive form of hit testing that will only work if the collision is
actually in view.

- First person view

Where geView is the window of your vehicle. Do a hittest at the left and right 
of
your window. when a test result comes back you calculate the distance between 
the
camera and hittest result and declare it a collision when it is within an 
arbitrary
distance. By using two hit tests you can animate collisions more realistically.

An example of this is implemented in www.planetinaction.com/helicopters

- third person view
With the milktruck example you either make sure the actual truck is always in 
the
same spot on your screen plane or you need to do a reverse of a hittest first. 
This
is a GEView Project. It shoots a ray from the coordinates of your vehicle to the
screen plane and produces your screen x and y coordinates. Then do a hittest 
using
those coordinates. The camera tilt is an important aspect here but with some 
math
easy to sort out. As before, when you get a hittest result calculate the 
distance
between your vehicle and the hit and declare it a collision when it is within an
arbitrary distance. You can further refine this by only accepting collisions 
when the
hittest result is in front of the vehicle as seen from the camera.
The Ateam game uses this method http://www.youtube.com/drivetheateamvan

Original comment by vandint...@gmail.com on 27 May 2010 at 11:21

GoogleCodeExporter commented 9 years ago
"Reported by api.roman.public, Aug 12, 2008", status is 'new' on June 08, 2010 ?

Original comment by trujillo...@gmail.com on 8 Jun 2010 at 2:15

GoogleCodeExporter commented 9 years ago

Original comment by api.roman.public@gmail.com on 28 Jul 2011 at 4:08