View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Ray Casting For Collision

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1Matt8110  Members

Posted 09 June 2013 - 08:55 PM

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.

Edited by Matt8110, 09 June 2013 - 09:31 PM.

### #2deftware  Prime Members

Posted 10 June 2013 - 11:47 AM

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.

### #3Matt8110  Members

Posted 11 June 2013 - 07:50 AM

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.

### #4Sponji  Members

Posted 11 June 2013 - 11:48 AM

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

### #5Matt8110  Members

Posted 11 June 2013 - 01:49 PM

Thank you, I will check that out.

### #6Matt8110  Members

Posted 13 June 2013 - 01:44 PM

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

### #7Matt8110  Members

Posted 14 June 2013 - 07:12 PM

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.