Hi Karen,
First let me say that although I work for Sun, I have
absolutely nothing to do with Java3D. Also like you I'm
investigating it for my own use and I have yet to write
a single line of code.
Now that that is out of the way, I think I might be able
to give you some insight that will help you find the answers
you're looking for. Remember though I have not actually
tried any of this, and I might be very wrong - I've picked
all this up from this mailing list like everyone else.
I think it's generally correct, but the details might be
wrong. Everyone else feel free to correct me :^)
First off, It seems to me that the "Collision Detection"
stuff built in to Java3D is probably not what you're
looking for. It's my impression that it is more of a
"callback" system where you register functions to be called
if a particular object in a scene collides with anyother
object in the scene. Then you sit back, let the behaviors
monitor the inputs and move the objects around, and if or
when the object you registered the callback function on
actually collides with something, then that function is
called, and is passed some limited info about what it
collided with. When you write this "callback function"
you are free to react to the collision any way you like.
This might be useful in some part of your application,
but from your description of your "sensor simulator"
it seems that its not what you are looking for, because
there is no notification of the collision until it already
has happened.
Don't rule Java 3D out yet though. There is another part
of the API which although it probably was developed and is
documented for an entirely different purpose, may do exactly
what you're looking for quite easily. This is the other method
of "collision detection" that some people have been talking
about on this mailing list. It should probably be refered to
as "collision prediction" though.
This other way of doing this involve using the "picking" part
of the Java3D API. This part of the API was (I think) mainly
developed with the idea that it would be used to allow users
to "pick" and manipulate objects in the scene graph using input
devices.
Because of the way it works it may be able to provide you
with something very close to what you're looking for. Basically,
when a user would try to pick an object with a mouse or other
input device, the API computes a vector from the user's eye
position through the point the selected by the user on the
viewing
plane. It then passes this vector to the picking routines which
return a list of objects the picking vector "hits".
If I've interpreted what many of the messages on the mailing
list are saying correctly, then if you were to create a vector
representing the position/direction of your distance sensor,
and to pass it to the picking routines, you'll get a list of
the objects in the scene graph that the vector passes through.
If you go through the list of objects returned, (I think it's
possible to have the list ordered closest first) compute the
distance between the object and the sensor (if that isn't
already
done for you,) fudge the value randomly to simulate the sensor's
accuracy, and format it and return it to your "controller" code
to see how it reacts.
As to how they've actually implemented the picking routines,
I haven't a clue, but if this collision prediction/distance
computation is your real focus, then you may want to ask
questions
about the picking part of JAva 3D instead of the collision part.
I Hope this has cleared some of this up, and I hope I didn't
get too much of it wrong. I'm sure there are plenty of
knowledgable
people on this list to correct me if I did. :^)
-Kyle
--
_
-------------------------------ooO( )Ooo-------------------------------
Kyle J. McDonald (o o) Systems Support Engineer
Sun Microsystems Inc. |||||
High End Server Engineering [EMAIL PROTECTED]
1 Network Drive BURL03-403 \\\// voice: (781) 442-2184
Burlington, MA 01803 (o o) fax: (781) 442-1646
-------------------------------ooO(_)Ooo-------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".