Unfortunately, like everything about 3d programming, there is no easy
answer.
There are many different techniques, but as a simple explanation the program
needs to make sure objects don't collide in the first place. For objects to
move they are being translated using some method. Lets say a transform3d.
At each frame you run through your objects and adjust the transform for each
object, applying forces to this object through math. You can do any math
you want, applying gravity, spring force (from jumps), transferred force
from collisions, viscosity forces, etc. But in the end of all your
calculations you have some change to the matrix for the object. The idea is
now to check to see if the result of applying this transformation will
result in a collision with another object. You could first take a copy of
the bounds of the object and transform it, then check these bounds against
all the objects "near" you. Obviously you need to have some way to cull out
objects from consideration, so you can just check the ones that have a
chance of colliding with. Then depending on your requirements you can
perform more detailed checks. Then if you determine that the move will
result in a collision you calculate the point of the collision and modify
the matrix to adjust for that. You can of course just not do the move, but
that would not be very realistic unless you were hitting the object straight
on. You can even transfer energy from the collision to have reasonable
bounces.
You can also create a special larger bounds objects for your object and use
Java3d collision detection, which is post-fact, but because you are using
bounds larger than needed, you still have time to stop the collision from
happening. Another technique is to send out a pickray along your vector of
movement to see if there is an object or objects in your way.
All valid techniques
> ----------
> From: Christopher Michael Morris[SMTP:[EMAIL PROTECTED]]
> Reply To: Christopher Michael Morris
> Sent: Wednesday, January 17, 2001 2:00 PM
> To: [EMAIL PROTECTED]
> Subject: [JAVA3D] 3D Games
>
> I am a Master's student in Computer Science and I'm wondering about the
> feasibility of using Java 3D for game development. I am pretty new to Java
> 3D
> (as well as Java) and have a general question about collission detection
> as it
> relates to games. If an object can only be in collision with one other
> object at
> a time, how do you handle an object (i.e. the main character in the game)
> constantly being in collision with what's underneath it? Also, in some
> games I
> have played, you can run along a wall (i.e. constant collision). Does
> anyone
> have any ideas about this? Does the question make sense?
>
> Chris Morris
>
> ==========================================================================
> =
> 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".
>
===========================================================================
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".