Ray Casting For Collision

Started by
5 comments, last by Matt8110 10 years, 10 months ago

I am not sure this is the correct place to post this, but I figured since I am using LWJGL, I would post in OpenGL, anyways, I am not that great at algebra, I just got done with pre-algebra and I can do everything in game development, but collision, I need to cast a ray for collision and no matter where I look I cannot find anywhere that explains it(And the ones that do over complicate it) So can someone please explain it to me? Thank you in advance, I really appreciate it.

EDIT:

I should mention i have experience with rays in things like Ultimate3D for game maker, so i do understand how a ray works, well somewhat, i know you cast a ray and it tell you how far away the object is and many other things, but i am not sure how one i created in something like java.

Advertisement

Typically, the object's motion over time *is* the ray being cast against other objects and world/scene geometry. Usually, an object is mathematically represented with a much simpler and inexpensive generalization, like a sphere or cylinder.

Checking for intersections with world geometry depends on what you're using to represent your world. Polygonal meshes are the most difficult - because you are forced to resort to hierarchical scene graph techniques to minimize the number of polys/triangles you are checking an object against - to do it with the entire scene can be murderous to a game's performance.

What you do once you find an intersection is known as 'collision response', and depends on the complexity of your simulation, the desired mechanical granularity (simple rigid-body physics, ragdoll physics with inverse kinematic solvers, etc)...

It can get crazy, but you should never have to incrementally trace rays to perform collision - the object is already moving incrementally, and you just need to see if any part of it intersects any part of anything else.

What I really need a ray for more than anything else is for selecting blocks, I am making a block game kind of like Minecraft and I need someway of selecting blocks.

I did a little voxel game too, and I think this was quite helpful for creating the collision check, http://www.cse.chalmers.se/edu/year/2010/course/TDA361/grid.pdf

Derp

Thank you, I will check that out.

Do you happen to know any good tutorials on creating a voxel game using java and LWJGL?

Would anyone be willing to help me make a voxel engine?

This topic is closed to new replies.

Advertisement