Game Development Community

Tiles collisions

by Bruno · in Torque Game Builder · 09/19/2005 (8:49 am) · 5 replies

Hi,

I have been reading this thread :
www.garagegames.com/mg/forums/result.thread.php?qt=33007

But i still can't get it working correctly,
With the debug info i can see the map tile ingame with the green quad around the tile, but i still get no collision.
I setup my code like this :


// Load tile layer from tile-map
	%bLayer1 = %scrollerMap.getTileLayer( 1 );

	// Generate Scrolling Sky, re-size to fill the whole screen
	%bLayer1.setPosition( "0 62" );
  
	%bLayer1.setWrap( false, false );
	%bLayer1.setAutoPan( "10 0" );
	%bLayer1.setCollisionMasks( BIT(2), BIT(2) );
	%bLayer1.setCollisionActive( true, true ); // SEND, RECIEVE 

	%bLayer1.setCollisionMaterial( standardMaterial );
	%bLayer1.setDebugOn( BIT(5) );

	%bLayer1.setGroup( 2 );
	%bLayer1.setLayer(20);

Is there something here missing ?
thanks,

Bruno

#1
09/19/2005 (8:53 am)
Could you post the code for the object your trying to collide against it ?
#2
09/19/2005 (8:56 am)
Sure.,

// Set player's collision info:
	$player.setGroup( 1 );
	$player.setLayer( 1 );
	$player.setCollisionActive( true, true );
	$player.setCollisionMaterial( standardMaterial );
	$player.setCollisionPolyCustom(4, "-1 0 -0.1 -0.6 0.98 0.15 -0.1 0.7" );
	$player.setCollisionMasks( BIT(2), BIT(2) );
	$player.setCollisionCallback( true );
#3
09/19/2005 (9:19 am)
%bLayer1.setCollisionMasks( BIT(2), BIT(2) );

I think this is where your problem is, your setting the collision masks to layer and group 2... while the $player is on layer and group 1
#4
09/19/2005 (9:30 am)
Thanks, but that's not the problem :(, changing it to BIT(1), BIT(1) makes no diference at all.
My player still goes trough the tiles as if they weren't there
#5
09/19/2005 (1:17 pm)
Ok, got it working..,
The tile Layer had to be 2 instead of 20....
thanks