Game Development Community

Beta 4 : Items not loaded properly ( solved in RC3)

by Bruno Grieco · in Torque Game Builder · 05/31/2006 (1:23 pm) · 1 replies

I have a level with over 3000 lines containing : A labyrinth, made of walls, blocks, triggers and Items.

Even though all the items are loaded ( I can see them on screen ), some don't seem to receive a collision call.

For example :
new t2dStaticSprite(Spriteitem3) {
		class = "SpriteItem";
		layer = $ItemLayer;
		GraphGroup = $ItemLayer;
		collisionLayers = $PlayerLayer;
		collisionGroups = $PlayerLayer;
		Visible = "1";
		Position = "-25.1575 2.3033";
		size = "4.74478 4.37291";
		collisionActiveSend = "1";
		collisionActiveReceive = "1";
		collisionCallback = "1";
		immovable = "0";
		// mountID = "657743";
		imageMap = "banana01";
		frame = "0";
		item = "3";
	};
	
	new t2dStaticSprite(Spriteitem4) {
		class = "SpriteItem";
		layer = $ItemLayer;
		GraphGroup = $ItemLayer;
		collisionLayers = $PlayerLayer;
		collisionGroups = $PlayerLayer;
		Visible = "1";
		collisionActiveSend = "1";
		collisionActiveReceive = "1";
		collisionCallback = "1";
		immovable = "0";
		Position = "-14.0583 17.6736";
		size = "4.04613 4.03232";
		// mountID = "657739";
		imageMap = "cabbage01";
		frame = "0";
		item = "4";
	};

Both items have the same configuration except for position,size,bitmap and item ( dynamic field ). I checked in the tree() utility and both are loaded with the correct parameters. Except that item 3 (banana) yields a collision ( correct ) and item 4 (cabbage ) doesn't.

The collision function is shown below :
function SpriteItem::onCollision( %srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, 
    %contactCount, %contacts ) 
    { 
       echo("On Collision ");
        echo(" " );
           
       if (%srcObj == $player) 
       { 
           %obj = %dstObj;
       }    
       else if (%dstObj == $player) 
              { 
                   %obj = %srcObj;
               } 
               else 
               { 
                    return;
               } 
                    
          
       %obj.safeDelete();        
    
    }

This also happens with one of the blocks that is INSIDE a region Trigger :
new t2dTrigger(RegiaoE) {
		class = "Region";
		Visible = "1";
		Position = "-34.9099 8.89738";
		size = "14.5818 21.502";
		layer = $RegionLayer;
		GraphGroup = $RegionLayer;
		collisionLayers = $PlayerLayer;
     	       collisionGroups = $PlayerLayer;
		collisionActiveSend = "1";
		collisionActiveReceive = "1";
		collisionPhysicsSend = "0";
		collisionPhysicsReceive = "0";
		
		immovable = "1";
		// mountID = "259";
		enterCallback = "1";
		stayCallback = "0";
		leaveCallback = "1";
	};

	new t2dStaticSprite(colisao12) {
		class = "Block";
		Visible = "1";
		Position = "-34.9964 7.65167";
		size = "4.87146 14.7298";
		collisionDetectionMode = "POLYGON";
		collisionResponseMode = "CLAMP";
		collisionActiveSend = "1";
		collisionActiveReceive = "1";
		collisionPhysicsSend = "1";
		collisionPhysicsReceive = "1";
		CollisionPolyList = "-1.00 -1.00 -1.00 1.00 1.00 1.00 1.00 -1.00"; 
		
		layer = $BlockLayer;
		GraphGroup = $BlockLayer;
		collisionLayers = $PlayerLayer;
		collisionGroups = $PlayerLayer;
		immovable = "1";
		// mountID = "1304";
		imageMap = "verde";
		frame = "0";
	};

If I remove the trigger, collision is detected.
But as you may see, both the block and trigger are on different Layers and are set to colide only with the player group & Layer

Any hints ??