Game Development Community

CLAMP response bug

by Michael Woerister · in Torque Game Builder · 01/16/2006 (7:58 am) · 22 replies

EDIT: this is T2D 1.1 ALPHA 2

It seems there is a bug in the CLAMP collision response. If I set a constant force for the scenegraph and let one object sit on a immoveable other one, the first object slowly sinks into the other one:

www.unet.univie.ac.at/~a0402917/pixel/ClampBug.png
Here is the code I use:

...
        // ************************************************************************
	//
	// Add your custom code here...
	//
	// ************************************************************************
	
	t2dScene.setConstantForce("0 50",true);
	t2dScene.setDebugOn(255);
	
	
	$floor = new t2dStaticSprite() {scenegraph = t2dScene;};
	
	$floor.setImageMap(imageMap1234);
	$floor.setImmovable( true );
	$floor.setPosition("0 25");
	$floor.setSize("80 10");
	$floor.setGroup(1);
	$floor.setCollisionPolyPrimitive(4);
	$floor.setCollisionActive(true,true);
	$floor.setCollisionPhysics(true,true);
	$floor.setCollisionResponse( CLAMP );

	
	$obj = new t2dStaticSprite() {scenegraph = t2dScene;};	
	$obj.setImageMap(imageMap1234);
	$obj.setFrame(1);
	$obj.setPosition("0 0");
	$obj.setSize("10 10");
	$obj.setCollisionMasks(BIT(1));
	$obj.setCollisionPolyPrimitive(4);
	$obj.setCollisionActive(true,true);
	$obj.setCollisionPhysics(true,true);
	$obj.setCollisionResponse( CLAMP );

	$actionmap = new ActionMap();
	$actionmap.bindCmd(keyboard,"a","$obj.setLinearVelocityX(-50);","$obj.setLinearVelocityX(0);");
	$actionmap.bindCmd(keyboard,"d","$obj.setLinearVelocityX(50);","$obj.setLinearVelocityX(0);");
	$actionmap.bindCmd(keyboard,"w","$obj.setImpulseForce(\"0 -100\");","");
	$actionmap.push();

This does not happen if both objects are set to RIGID.

- Michael
Page«First 1 2 Next»
#21
02/02/2006 (12:34 pm)
ASAP. :)
Excepting tiles in one direction, wich attempt has been delayed in order to get *mass* as
levels, heros, music, arms. I think I have now every piece I need.
I can't disclose more, but when our game will be in a decent state it will be posted here.
Of course we want to employ the *impact* factor.
I think ending march.
Regards.
#22
02/03/2006 (12:00 am)
Good stuff, I look forward to it.

- Melv.
Page«First 1 2 Next»