Game Development Community

Mounting objects to players

by Michigan State University (#0004 · in Torque Game Engine · 11/02/2005 (3:35 pm) · 1 replies

I'm trying to create a way for "destructable armor" on a player, by creating armor objects as ShapeBaseData objects and then mounting those objects to players. However it's not working...

The following code works, in that it succesfully mounts the cube image to the player but then collision does not appear to be supported:

datablock ShapeBaseImageData( CubeImage )
{
    shapeFile = "~/data/shapes/cube/cube.dts";
};

function AIPlayer::spawn( %name, %spawnPoint )
{

  ...................

	%player.mountImage( CubeImage, 0 );
	return %player;
}

The following code does not work. When the game runs, nothing appears to be mounted to the player:

datablock ShapeBaseData(Cube)
{
	category = "Cube";
	shapeFile = "~/data/shapes/cube/cube.dts";
};

function AIPlayer::spawn( %name, %spawnPoint )
{

    ..............

	%player.mountObject( Cube, 0 );

	return %player;
}

Any ideas on how to make this work, or if I'm going about it all wrong?

Thanks!

#1
11/02/2005 (4:22 pm)
You can't Mount Datablocks.



datablock StaticShapeObject(Cube)
{
category = "Cube";
shapeFile = "~/data/shapes/cube/cube.dts";
};

%newcube= new StaticShape() {
dataBlock = Cube;
};

%player.mountObject(%newcube, 0);

create a new object, then mount