#ActualPrecision

Disabling the Menu bar at the top, and disabling the window bar ( Making the window a PoPup basically) Fixed the issue.

They were throwing off the onscreen values!

Hello, I'm building a button class in which it will take in a sprite object that I also created, and use the position and dimensions of the sprite to generate a bounding box around it to check for collisions with the mouse With Min Max Collision Detection.

The Collision Detection algorithm I'm using is definitely not the problem, as I can see the bounding box being put in the wrong place.

Below is the code that generates the bounding box for the sprite:

ButtonCollisionBox is a structure of just floats.

ButtonNuteral is the sprite class I wrote.

Sprites are supposedly drawn from the top left, so I set the boundingboxes Min to the ButtonNuterals Position, and I set the BoundingBox max to the ButtonNuterals Width and Height from the sprites position.

Yet the bounding Box comes out in the wrong place, (1- 2 pixels Under the D in "Dynamic Bounding Box") as seen in Problem.png.

During Runtime, the collision Box is:

Left = 960

Top = 540

Right = 1472

Bottom = 668

And the Sprite is:

Sprites Position: 960,540

Dimension 512,128

Nothing is being scaled. Can someone please help?

Why are they at the same positions, yet the bounding box isn't bounding the whole image?!

#2Precision

Posted 24 May 2013 - 12:00 AM

Hello, I'm building a button class in which it will take in a sprite object that I also created, and use the position and dimensions of the sprite to generate a bounding box around it to check for collisions with the mouse With Min Max Collision Detection.

The Collision Detection algorithm I'm using is definitely not the problem, as I can see the bounding box being put in the wrong place.

Below is the code that generates the bounding box for the sprite:

ButtonCollisionBox is a structure of just floats.

ButtonNuteral is the sprite class I wrote.

Sprites are supposedly drawn from the top left, so I set the boundingboxes Min to the ButtonNuterals Position, and I set the BoundingBox max to the ButtonNuterals Width and Height from the sprites position.

Yet the bounding Box comes out in the wrong place, (1- 2 pixels Under the D in "Dynamic Bounding Box") as seen in Problem.png.

During Runtime, the collision Box is:

Left = 960

Top = 540

Right = 1472

Bottom = 668

And the Sprite is:

Sprites Position: 960,540

Dimension 512,128

Nothing is being scaled. Can someone please help?

Why are they at the same positions, yet the bounding box isn't bounding the whole image?!

#1Precision

Posted 23 May 2013 - 11:53 PM

Hello, I'm building a button class in which it will take in a sprite object that I also created, and use the position and dimensions of the sprite to generate a bounding box around it to check for collisions with the mouse With Min Max Collision Detection.

The Collision Detection algorithm I'm using is definitely not the problem, as I can see the bounding box being put in the wrong place.

Below is the code that generates the bounding box for the sprite:

ButtonCollisionBox is a structure of just floats.

ButtonNuteral is the sprite class I wrote.

Sprites are supposedly drawn from the top left, so I set the boundingboxes Min to the ButtonNuterals Position, and I set the BoundingBox max to the ButtonNuterals Width and Height from the sprites position.