Overlapping collisions with simple scene
by Patrick Shaw · in Torque Game Builder · 11/27/2007 (7:13 am) · 3 replies
Hi,
I have fairly simple scene in 1.5.1 and having trouble with inter-penetrating collision. Basically, I have:
* A "player" staticImageMap. Using the WASD keys sets the player's linear velocity to up/down/left/right
* A maze of "block" staticImageMaps. I am not using tilemaps "blocks" because the player will be able to move the blocks.
* Both the player and blocks have basic collision parameters (collisions and physics set to send/receive, simple square collision polygon, etc.)
When the player is moving around the maze, eventually the player's sprite will eventually intersect one of the blocks. The collision system pushes the block out of the way, causing more intersections, which in turns causes a chain reaction that disrupts most of the blocks.
I have tried setting the blocks to "immovable" which fixes the chain reaction. However, when the player sprite penetrates the block, the player's sprite either jumps or gets stuck in the block. This seems to happen most often when the sprite corners touch.
Ideally, I would like a solution to prevent the sprites ever overlapping. I could create a behavior that does a castCollision in the onUpdateCallback, but that seems like overkill and inefficient.
Any suggestions? Thanks!
Patrick
I have fairly simple scene in 1.5.1 and having trouble with inter-penetrating collision. Basically, I have:
* A "player" staticImageMap. Using the WASD keys sets the player's linear velocity to up/down/left/right
* A maze of "block" staticImageMaps. I am not using tilemaps "blocks" because the player will be able to move the blocks.
* Both the player and blocks have basic collision parameters (collisions and physics set to send/receive, simple square collision polygon, etc.)
When the player is moving around the maze, eventually the player's sprite will eventually intersect one of the blocks. The collision system pushes the block out of the way, causing more intersections, which in turns causes a chain reaction that disrupts most of the blocks.
I have tried setting the blocks to "immovable" which fixes the chain reaction. However, when the player sprite penetrates the block, the player's sprite either jumps or gets stuck in the block. This seems to happen most often when the sprite corners touch.
Ideally, I would like a solution to prevent the sprites ever overlapping. I could create a behavior that does a castCollision in the onUpdateCallback, but that seems like overkill and inefficient.
Any suggestions? Thanks!
Patrick
About the author
#2
11/27/2007 (11:50 am)
Turn recieve physics off on the blocks. It will mean that physics wont be updated when a collision is recieved by them. It should fix it.
#3
That was one of first things I tried :) I found that, like setting the object to "immovable", disabling the physics does prevent the chain reaction pile up. However, the player can still punch through the blocks, either jumping around or getting stuck in the block.
11/27/2007 (12:13 pm)
Phillip, That was one of first things I tried :) I found that, like setting the object to "immovable", disabling the physics does prevent the chain reaction pile up. However, the player can still punch through the blocks, either jumping around or getting stuck in the block.
Chaim Krause
Chaim Gang