Solve Overlap?
by Joshua Butterworth · in Torque X 2D · 02/28/2007 (8:00 am) · 4 replies
I'm sure this has been answered already but i cant find it now (this forum seriously needs search functionality).
What does the solveOverlap attribute of T2DPhysicscomponent do? And how do I make it work? I read that in Torque it adjusts objects positions so they don't overlap, I cant seem to make it do that in TorqueX.
To use the Spaceshooter starter kit as an example, could i use it to stop the enemies bunching together (if you fly around enogh you can get 20 or so enemies occupying a 100 square pixel area)?
I tried just setting solveOverlap to true, that did nothing as far as i can see, I tried adding the object type to the list of those the enemy collides with this, as i thought, just made the enemies blow eachother up when they get close enough.
What does the solveOverlap attribute of T2DPhysicscomponent do? And how do I make it work? I read that in Torque it adjusts objects positions so they don't overlap, I cant seem to make it do that in TorqueX.
To use the Spaceshooter starter kit as an example, could i use it to stop the enemies bunching together (if you fly around enogh you can get 20 or so enemies occupying a 100 square pixel area)?
I tried just setting solveOverlap to true, that did nothing as far as i can see, I tried adding the object type to the list of those the enemy collides with this, as i thought, just made the enemies blow eachother up when they get close enough.
#2
Didnt realise the search bar searched the forum as well *smacks head*
02/28/2007 (12:17 pm)
So if you have to set up a collision component, specify what to collide with and what to do when you collide..what does setting solve overlap to true do?Didnt realise the search bar searched the forum as well *smacks head*
#3
02/28/2007 (2:45 pm)
When a collision happens, normally two things follow: the overlap is resolved and there is a physics response. While in many cases the physics response will prevent overlaps, it's not guaranteed to. SolveOverlap should be turned on for objects that you don't want to overlap when colliding. If you turn it off and use a physics resolve that allows objects to pass through each other, you can get OnCollision callbacks without physically disturbing the objects.
#4
Just changed the _onCollision in the destructibleComponent to check if it was an enemy colliding with an enemy and do nothing if that was the case, set enemys to collide with eachother, set SolveOverlap to true and it works a treat.
thanks for the help.
Edit: Actually I tell a lie it's just running its resolveCollision action now *smacks head again*, still that gets the job done i guess.
03/01/2007 (2:36 am)
Edit: Tested itJust changed the _onCollision in the destructibleComponent to check if it was an enemy colliding with an enemy and do nothing if that was the case, set enemys to collide with eachother, set SolveOverlap to true and it works a treat.
thanks for the help.
Edit: Actually I tell a lie it's just running its resolveCollision action now *smacks head again*, still that gets the job done i guess.
Torque Owner Ben R Vesco
2. I'm not sure this has been answered already.
3. Overlap should be working fine and should do what you want it to do. You'll need to do more than simply turn it on. Overlap probably only solves overlap on objects that can collide with one another (otherwise how would it know to check for overlap?). The enemies in space shooter are set up to explode when the collide. You are on the right track. You need to turn on overlap and set the object types so enemies will collide with one another. The last step you haven't yet taken is to alter the response of enemies to a collision. Instead of blindly exploding on a collision you'll have to make them see what it was they collided with. If it is a missile they can still explode but if it is another enemy maybe you want something else to happen? I think it makes sense in that particular game world for spaceships to explode when they collide but ignoring the context all you have to do is make them respond differently to different types of collisions.