souper123/UniverseCubed — pull request #1 by inolen (2014-11-03 20:11:51+00:00)
Title: collision fixes

Hey Nate, I took at the collision issues just now, here's what I ended up changing:

* changed camera near clip plane to 0.01f instead of 0.3f
* changed default cube bounding box to { 1.0f, 1.0f, 1.0f } in order to match the rendered size
* set default camera position to { 0.0f, 0.0f, 2.0f }

Small changes in order to help debug initially.

* fixed canMove using delta z instead of delta x when setting the bounding box's x component

If you look at https://github.com/inolen/UniverseCubed/commit/b9ab141d98f59ccad430ee4c2d03ef8bb4870b98#diff-41bb6d3a14fe6ed248b267f2099292d5L54 you can see the old code:
`this.bbox.setX(this.position.getX() + z);`
was incorrect inside of `canMove` (it should be using delta x instead of delta z there).

* made canMove center the players bounding box around the camera

This was the other main issue with collision. Since the player's bounding box wasn't centered around the camera position, depending on which direction you were facing, collision would either happen when the camera was directly against the cube's surface, or a unit away from the surface. I'd try and draw this out to make sense of it, you can see the exact line changed here https://github.com/inolen/UniverseCubed/commit/b9ab141d98f59ccad430ee4c2d03ef8bb4870b98#diff-41bb6d3a14fe6ed248b267f2099292d5R53