Game Development Community

Particle Troubles - Invalid Datablock

by David Bigerstaff · in Torque Game Builder · 01/08/2006 (10:04 pm) · 3 replies

I'm having a nightmare tonight, i've just posted an empty thread (sorry about that), after having typed up what i wanted to say, so here we go again :P

Well the main reason for my post is that i'm having trouble creating a particle. I've done the basic tutorial fine and i cant for the life of me figure out why this wont work.

The specific error i'm getting is t2dParticleEmitter::setImageMap() - t2dImageMapDatablock Datablock is invalid! (particles5ImageMap)

function createFirework()
{
         %magic = new t2dParticleEffect() { scenegraph = t2dScene; };
         %magic.loadEffect("~/client/effects/smallThruster.eff");
         %magic.setPosition( $player.getPosition() );
         %magic.playEffect();
         echo("$player.getPosition() = " @ $player.getPosition() );
}

I call that function every time i click the mouse and the console.log looks like this each time.


t2dParticleEmitter::setImageMap() - t2dImageMapDatablock Datablock is invalid! (particles5ImageMap)
$player.getPosition() = -20.000000 22.923536


Thanks for looking!

David

#1
01/08/2006 (11:54 pm)
Are you defining the particles5 graphic along with your other graphic datablocks? Assuming you're using the particles5 image from the tutorial, you want to add this to your datablocks:
datablock t2dImageMapDatablock(particles5ImageMap)
{
	imageName = "~/client/images/particles5";
	imageMode = cell;
	cellWidth = 64;
	cellHeight = 64;	
	filterPad = false;
};
#2
01/09/2006 (12:17 am)
Philip is correct; the "smallThruster.eff" is complaining that a datablock it uses "particle5Imagemap" isn't defined.

This is one of the datablocks defined in the "demoDatablocks.cs" file that are used for the demos and demo-particle effects. You can obviously go into the editor and change which image-map/animation the effect uses but it's best to save it as another name if you do. Either that or just add the image-map definition back in as per Philips instructions.

Cheers,

- Melv.
#3
01/09/2006 (4:36 am)
Thanks guys i got it working.

It turned out that i'd initially taken out the exec("./demoDatablocks.cs");

and then I didnt have particles5.png in my image directory.

Thanks again!