Hello Guest

Author Topic: Surfaces and Collisions  (Read 1933 times)

0 Members and 1 Guest are viewing this topic.


  • Member
  • Posts: 26
    • View Profile
Surfaces and Collisions
« on: July 21, 2015, 08:40:11 PM »
I came across an issue while working on my gui lib.

If I create a surface, and bind all my gui entities to that surface, the graphics display perfectly.  The problem is, the colliders dont.

The X/Y of the entity will draw the graphic relative to the gui surface, but the collider will appear at the X/Y of the game surface.  This isnt a problem if your camera is never going to move.  But if you center the camera on 0,0, and place a gui entity at say 50,50 on the gui surface and add a collider.  The graphic appears in the top left of the screen at 50,50 but the collider for it appears in the bottom right of the screen somewhere, and moves with the camera.

A work around for this is to write a method, which updates the position of the collider relative to the current position of the camera, but if you were to zoom or rotate the camera, the graphic stays fixed but again, the collider moves with the camera.

I would expect that if an entity is bound to a surface, ALL of the entity should bind to the surface.