Tile collision bug
by Spencer Grey · in Torque Game Builder · 06/19/2006 (1:02 pm) · 3 replies
FIXED -- IGNORE THIS UNTIL DELETED. CENTER POINT OF WALL WASNT IN BOX
Hey,
I have 4 walls (for each direction) that each have a custom polygon assigned to it for collision detection. The bug I'm experiencing is that for a single side of each wall, the collision makes my character run straight through it very fast instead of clamping. All three other sides are fine.
An example of the poly is :
-1.000000 -1.000000
-0.500000 -1.000000
-0.500000 1.000000
-1.000000 1.000000
To represent this, lets say
______
| |
| |
| |
|______|
is your tile.
For my left wall, (which is the poly I specified above), the polygon looks something like
__
| |
| |
| |
|__|
All I'm doing is creating a rectangle that takes up the left quarter of the tile. However, if I run into the right side of that polygon, I'm going to shoot straight through it and come out on the left of it. I'm really baffled as to why this is happening.
My player is just a small circle, since this is taking place on a radar-ish looking screen. I never assigned a collision poly to him, since my understanding is the default poly is full. Which is what I want (for now atleast).
Any help would be much appreciated.
Hey,
I have 4 walls (for each direction) that each have a custom polygon assigned to it for collision detection. The bug I'm experiencing is that for a single side of each wall, the collision makes my character run straight through it very fast instead of clamping. All three other sides are fine.
An example of the poly is :
-1.000000 -1.000000
-0.500000 -1.000000
-0.500000 1.000000
-1.000000 1.000000
To represent this, lets say
______
| |
| |
| |
|______|
is your tile.
For my left wall, (which is the poly I specified above), the polygon looks something like
__
| |
| |
| |
|__|
All I'm doing is creating a rectangle that takes up the left quarter of the tile. However, if I run into the right side of that polygon, I'm going to shoot straight through it and come out on the left of it. I'm really baffled as to why this is happening.
My player is just a small circle, since this is taking place on a radar-ish looking screen. I never assigned a collision poly to him, since my understanding is the default poly is full. Which is what I want (for now atleast).
Any help would be much appreciated.
#2
06/19/2006 (3:48 pm)
If you put [ code ] drawing [ / code ] (removing the spaces, of course) then it will keep your formatting
#3
When the walls collision box is smaller then 2 x 0.9, then my sprite zooms right through it.
So for the side of the rectangle that isnt the full length, if its ranging from -1.0 to -0.1 then it works, if its ranging from -1.0 to -0.2 or less, then he zooms through.
It looks to me like the collision detection is thinking that hes on the other side of the center point, so he gets rubberbanded back to the wrong size. So its not that hes able to walk through it, hes just being placed in the wrong spot by the collision detection.
Hope the illustrations help convey what I'm talking about here. I'm not sure what to do about this. I really dont want to resize everything, but if I have to I will.
-edit: stupid drawing still got messed up, but its close enough
Ideally my walls would only be about 0.3 thick, so the player can both brush up against the graphic and have plenty of room to walk in the narrow corridors.
If anyone can help, I'd really appreciate it. I have no idea why this is happening, and it's going to change the whole look of the game if I change the tiles.
--
Alright, did another test. My sceneWindow is 1024 x 768. If my player size is "4 4" or bigger, then the collision works correctly *even at -1 to -0.8*. Thats a 0.2 thickness. Exactly what I want.
However, if my player size is "3 3" or below, then he zooms through. Ofcourse, my player size is supposed to be "1 1" for this view.
Help =/.
06/21/2006 (9:07 am)
Hey, I did a bit of playing around, and I figured out *when* this is happening. I still dont understand why. I'm not sure if its my code (which I cant see how it could be), or a bug.When the walls collision box is smaller then 2 x 0.9, then my sprite zooms right through it.
So for the side of the rectangle that isnt the full length, if its ranging from -1.0 to -0.1 then it works, if its ranging from -1.0 to -0.2 or less, then he zooms through.
It looks to me like the collision detection is thinking that hes on the other side of the center point, so he gets rubberbanded back to the wrong size. So its not that hes able to walk through it, hes just being placed in the wrong spot by the collision detection.
______ |______| -1 to -0.5 (doesnt work) ______ | | -1 to -0.1 (does work) |______|
Hope the illustrations help convey what I'm talking about here. I'm not sure what to do about this. I really dont want to resize everything, but if I have to I will.
-edit: stupid drawing still got messed up, but its close enough
Ideally my walls would only be about 0.3 thick, so the player can both brush up against the graphic and have plenty of room to walk in the narrow corridors.
If anyone can help, I'd really appreciate it. I have no idea why this is happening, and it's going to change the whole look of the game if I change the tiles.
--
Alright, did another test. My sceneWindow is 1024 x 768. If my player size is "4 4" or bigger, then the collision works correctly *even at -1 to -0.8*. Thats a 0.2 thickness. Exactly what I want.
However, if my player size is "3 3" or below, then he zooms through. Ofcourse, my player size is supposed to be "1 1" for this view.
Help =/.
Torque Owner Spencer Grey
Use your imagination, I guess >.<.