Can a mounted object have different collision properties?
by Philip Mansfield · in Torque Game Builder · 04/13/2006 (3:13 am) · 1 replies
I've got an enemy that I want to collide with the player. This is working. That sprite also needs to collide with the platforms in my level. This isn't working.
I can't use the enemy collision poly for detecting player collisions when I check for platform collisions. I change that poly based on the direction the enemy is moving in, so I get some odd collision results. So I figured I'd mount a dummy object to the enemy, and then use that to detect the platform collisions. Unfortunately things don't seem to be working as expected.
Here's the code:
However, if I change the dummy code to read:
It just seems to not work properly when mounted. Can I not have mounted objects colliding with different groups and layers than the parent object?
If not, any suggestions as to how to achieve my desired result?
I can't use the enemy collision poly for detecting player collisions when I check for platform collisions. I change that poly based on the direction the enemy is moving in, so I get some odd collision results. So I figured I'd mount a dummy object to the enemy, and then use that to detect the platform collisions. Unfortunately things don't seem to be working as expected.
Here's the code:
$vulture = new t2dAnimatedSprite() { scenegraph = t2dScene; };
$vulture.setGraphGroup( $enemyGroup );
$vulture.setLayer( $enemyLayer );
$vulture.setCollisionMasks(BIT($playerGroup), BIT($playerLayer));
$vulture.setCollisionCallback(true);
$vulture.setCollisionActive(true, false);
$vulture.setImmovable(true);
$vulture.setSize( "64 64" );
$vulturedummy = new t2dSceneObject() { scenegraph = t2dScene; };
$vulturedummy.setGraphGroup( $enemyGroup );
$vulturedummy.setLayer( $enemyLayer );
$vulturedummy.setCollisionPolyPrimitive(8);
$vulturedummy.setCollisionMasks(BIT($platformGroup), BIT($platformLayer));
$vulturedummy.setCollisionCallback(true);
$vulturedummy.setCollisionActive(true, false);
$vulturedummy.setSize( "64 64" );
$vulturedummy.mount($vulture, 0,0, 0, false, true, false);With things like this, the vulture will happily fly through the platforms. Collisions with the player work fine. However, if I change the dummy code to read:
$vulturedummy = new t2dSceneObject() { scenegraph = t2dScene; };
$vulturedummy.setGraphGroup( $enemyGroup );
$vulturedummy.setLayer( $enemyLayer );
$vulturedummy.setCollisionPolyPrimitive(8);
$vulturedummy.setCollisionMasks(BIT($platformGroup), BIT($platformLayer));
$vulturedummy.setCollisionCallback(true);
$vulturedummy.setCollisionActive(true, false);
$vulturedummy.setSize( "64 64" );
$vulturedummy.setPosition("0 0");
$vulturedummy.setLinearVelocityY(10);
// $vulturedummy.mount($vulture, 0,0, 0, false, true, false);Then it drops down and lands on a platform.It just seems to not work properly when mounted. Can I not have mounted objects colliding with different groups and layers than the parent object?
If not, any suggestions as to how to achieve my desired result?
Torque Owner Philip Mansfield
Default Studio Name
Please delete :)