Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualMythix

Posted 04 June 2013 - 11:21 AM

My collision detection seems to work well. Responding to it, however, does not. My terrain is made of cubes. My player is made of a cube. They are all axis aligned. As my terrain is divided up into cubes, I simply check to see if every corner of the player's cube is in empty space or a solid block. If even one is in a solid block, then I know a collision has occurred.

I'm wanting to slide the player along the plane of the collision, but I'm having some difficulty understanding how to identify the plane to slide on and how. Everything I've tried so far seems to have issues determining the exact plane to slide on/propel from.

As the picture below demonstrates, from one frame to the next, if the red square moved from bottom up as the arrow points, I need something to show that the bottom face of the black square is what was collided with (or the top face of the red square).

 

phOST.png


#2Mythix

Posted 04 June 2013 - 10:23 AM

Hello all,

 

My collision detection is a little cheesy in that the terrain is nothing but cubes (minecraft style) and the player is just a mini-cube. It's all being done by taking the 8 corners of the player's cube and checking what terrain cube they would each fall into if moved. If the terrain cube they would fall in is supposed to be a solid block, it then recognizes the collision. At the moment, it just stops moving the player when the movement would lead to a collision. All cubes are axis aligned in this case.

 

I'm wanting to slide the player along the plane of the collision, but I'm having some difficulty understanding how to identify the plane to slide on and how. 

 

Everything I've tried so far seems to have issues with the player's mini-cube intersecting multiple terrain cubes simultaneously.

 

I really feel like this should be simple and all resources I seem to find don't seem to match my exact situation.

 

Anyone have any suggestions?


#1Mythix

Posted 04 June 2013 - 10:22 AM

Hello all,

 

My collision detection is a little cheesy in that the terrain is nothing but cubes (minecraft style) and the player is just a mini-cube. It's all being done by taking the 8 corners of the player's cube and checking what terrain cube they would each fall into if moved. If the terrain cube they would fall in is supposed to be a solid block, it then recognizes the collision. At the moment, it just stops moving the player when the movement would lead to a collision.

 

I'm wanting to slide the player along the plane of the collision, but I'm having some difficulty understanding how to identify the plane to slide on and how. 

 

Everything I've tried so far seems to have issues with the player's mini-cube intersecting multiple terrain cubes simultaneously.

 

I really feel like this should be simple and all resources I seem to find don't seem to match my exact situation.

 

Anyone have any suggestions?


PARTNERS