Physics issue
by Eric Smith · in iTorque 2D · 05/27/2010 (2:32 pm) · 4 replies
Hi all,
I'm having a physics issue with my game. When I fire a projectile at an enemy, the enemy velocity will zero until they think to start moving again. I dont want this to happen. Even when I touch my player avatar to the enemy avatar, I'm able to push them as well. Which I also dont want to happen. If I dont use the usePhysics, then of course they dont move. I've tried changing physics properties on the avatars and the projectiles but they have no effect. (ie automassinertia = false, mass = 0, ect)
I should also mention that when the player avatar fires a projectile or is hit by a projectile, they dont move. When the enemy fires a projectile, they enemy avatar is moved to one side or the other by the projectile as they fire it.
Here is my player base config:
The enemies inherit this config aside from the fact that they are in graphGroup 2.
Here is the base projectile config:
Anybody else have this problem that you've overcome?
Any help would be greatly appreciated.
I'm having a physics issue with my game. When I fire a projectile at an enemy, the enemy velocity will zero until they think to start moving again. I dont want this to happen. Even when I touch my player avatar to the enemy avatar, I'm able to push them as well. Which I also dont want to happen. If I dont use the usePhysics, then of course they dont move. I've tried changing physics properties on the avatars and the projectiles but they have no effect. (ie automassinertia = false, mass = 0, ect)
I should also mention that when the player avatar fires a projectile or is hit by a projectile, they dont move. When the enemy fires a projectile, they enemy avatar is moved to one side or the other by the projectile as they fire it.
Here is my player base config:
datablock t2dSceneObjectDatablock( PlayerConfig )
{
class = "Player";
superClass = "aStarActor";
usesPhysics = "1";
size = "64 64";
layer = 10;
graphGroup = 1;
collisionGroups = BIT(0) | BIT(1) | BIT(2) | BIT(4) | BIT(9) | BIT(10) | BIT(11);
CollisionPolyList = "-0.50 -0.50 0.50 -0.50 0.50 0.50 -0.50 0.50";
collisionResponseMode = CLAMP;
CollisionActiveSend = true";
CollisionActiveReceive = true;
collisionPhysicsSend = false;
collisionPhysicsReceive = false;
CollisionCallback = true;
};
datablock t2dSceneObjectDatablock( AIPlayerConfig : PlayerConfig )
{
class = "AIPlayer";
superClass = "aStarActor";
graphGroup = 2;
...
};The enemies inherit this config aside from the fact that they are in graphGroup 2.
Here is the base projectile config:
datablock t2dSceneObjectDatablock( ProjectileConfig )
{
class = "Projectile";
usesPhysics = "1";
layer = 10;
graphGroup = 9;
collisionResponseMode = CLAMP;
collisionActiveSend = false;
collisionActiveReceive = true;
collisionPhysicsSend = false;
collisionPhysicsReceive = false;
collisionCallback = true;
collisionPolyList = "0.4 -0.4 0.4 0.4 -0.4 0.4 -0.4 -0.4";
};Anybody else have this problem that you've overcome?
Any help would be greatly appreciated.
About the author
http://ca.linkedin.com/pub/eric-smith/2/56/a51
#2
05/27/2010 (4:05 pm)
Updated. Thanks. That's what I meant by the inheritance.
#3
But one thing I get from this setup is that the usage of collision layers is not that optimal, but I might be wrong.
Normally you would put the Player rojectile into the AI Player collision layer (or one of them) which is not used by the Player and vice versa the AI Player projectile is using a collision layer thats only used by the Player.
That way they don't interact with their shooting Player objects (and save cpu time on the collision calculation as well), which might be whats causing the problem here. Especially if the collision response potentially is set to clamp
05/27/2010 (8:09 pm)
Can't comment on the actual issue I fear.But one thing I get from this setup is that the usage of collision layers is not that optimal, but I might be wrong.
Normally you would put the Player rojectile into the AI Player collision layer (or one of them) which is not used by the Player and vice versa the AI Player projectile is using a collision layer thats only used by the Player.
That way they don't interact with their shooting Player objects (and save cpu time on the collision calculation as well), which might be whats causing the problem here. Especially if the collision response potentially is set to clamp
#4
06/03/2010 (9:42 pm)
I changed around the graphGroups a bit and got the problem solved. Thanks for replying!
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
I see that you declare it but I lack the : PlayerConfig in the declaration there to inherit from it ...