setCollisionSupress and Contacts
by practicing01 · in Torque 2D Professional · 07/12/2013 (8:59 am) · 7 replies
I have a static "wall" object and a dynamic "player" object. The player has +Y velocity and collides with the wall, setting the player Y velocity to 0. I have a function that resets the +Y velocity for movement. I verify that velocity was set using getLinearVelocity. I set the wall to supress collision and call the velocity reset function. There is no +Y movement, however. It works fine if instead of supressing, I delete collision shapes of the wall. The docs say that gathering contacts is off by default. I look at the setCollisionSupress() code and don't see interaction with contacts. I look at the clearCollisionShapes() code and see deletion of contacts (box2d/Dynamics/b2Body.cpp line: 244). Should I add contact deletion code to setCollisionSupress()?
#2
If you were more clear then it'd be easier to help but as it stands, it's an interpretation game.
07/16/2013 (8:02 am)
Neither of these last two posts are clear on what you are trying to achieve and how you go about it and exactly what is failing.If you were more clear then it'd be easier to help but as it stands, it's an interpretation game.
#3
Object can't go through wall. I suppress wall collision. Object still can't go through wall.
Why wouldn't the object be able to go through the wall if I suppressed it's collision?
07/16/2013 (9:56 pm)
My first post explained in detail, I can't make it any clearer than that. Perhaps putting it abstractly would make it clearer.Object can't go through wall. I suppress wall collision. Object still can't go through wall.
Why wouldn't the object be able to go through the wall if I suppressed it's collision?
#4
If you suppress collision on either object that could be involved in a collision then no collision occurs. You can see the code-path for this is extremely simple in that the SceneObject has its mCollisionSuppress set and the contact filter checks this when a potential contact comes in.
You cannot suppress existing contacts when a contact is already in progress. Collision suppression is for when you want to have an object configured for collisions but be able to turn on/off those collisions without having to reconfigure the object itself.
I'm pretty confused as to why you have collision shapes on a "wall" if you don't want things to collide with it.
If you could state clearly what dynamic between the wall and object you're trying to achieve then it's be easier to advise.
07/18/2013 (1:25 am)
No, your first post was a mix of features not clearly explaining the situation. Your last past clearly indicates the problem and what you're doing.If you suppress collision on either object that could be involved in a collision then no collision occurs. You can see the code-path for this is extremely simple in that the SceneObject has its mCollisionSuppress set and the contact filter checks this when a potential contact comes in.
You cannot suppress existing contacts when a contact is already in progress. Collision suppression is for when you want to have an object configured for collisions but be able to turn on/off those collisions without having to reconfigure the object itself.
I'm pretty confused as to why you have collision shapes on a "wall" if you don't want things to collide with it.
If you could state clearly what dynamic between the wall and object you're trying to achieve then it's be easier to advise.
#5
https://github.com/practicing01/Dots-and-Crits/blob/master/modules/levels/bitweb/assets/scripts/dynamicworldobjects/gates/xorinnergates.cs
You can see my intended behaviour with the walls by playing the "Bitweb" game-mode in my sandbox ;) (choose the shura or lidia character).
07/18/2013 (5:36 am)
I got past the bug by deleting the collision shapes and suppressing.https://github.com/practicing01/Dots-and-Crits/blob/master/modules/levels/bitweb/assets/scripts/dynamicworldobjects/gates/xorinnergates.cs
You can see my intended behaviour with the walls by playing the "Bitweb" game-mode in my sandbox ;) (choose the shura or lidia character).
#6
Doesn't make any sense to me but if it works for you then fine.
EDIT: I tried your game but I have no idea how to use it nor do I know what I'm actually looking for that relates to this problem.
07/18/2013 (8:10 am)
What bug? I have no idea why you would want to delete collision shapes. Why set them up in the first place? If you delete collision shapes then why suppress collision, there won't be any collisions without them?Doesn't make any sense to me but if it works for you then fine.
EDIT: I tried your game but I have no idea how to use it nor do I know what I'm actually looking for that relates to this problem.
#7
07/18/2013 (8:15 am)
The bug is that when I tell the engine to suppress collision, it doesn't. It doesn't matter if it was coded to not suppress collision if there is contact. Call it bad design if you don't want to call it a bug. The only way around it is to both delete the collision shapes and suppress collision.
Michael Smith