Game Development Community

Different effect hit character vs terrain

by Matt Monforte · in Torque Game Engine · 12/02/2006 (11:21 pm) · 2 replies

I'm looking to do some blood splatter/cloud effects for when the projectile hits a player. This means the effect would have to be different then if the projectile hits terrain. Could someone point me in the right direction?

#1
12/03/2006 (2:35 am)
Not quite what you want but may give you what you want try this resource:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2884
#2
12/03/2006 (3:04 am)
What I did for Air Ace was to add a "material meta info" field to every object in the world (I think it was on SimObject level) - this is done in engine code, but you might be able to fake it in script.

Then in the projectils onCollision you get a reference to the object the projectile collided with.

You simply then do something like:

// Spawn explosion
  
  	// To our disposal we have:
	// dirt, rock, building, metal (tank, train, whatever), plane, and water
	// dirt being default
	
	// Spawn particle emitters based on water or object hit
	if (%col.getMaterialInfo() $= "water") {

		spawnExplosion(%pos, "0 0 1", 0, "TracerWaterExplosion");

	} else  if (%col.getMaterialInfo() $= "plane") {

		spawnExplosion(%pos, "0 0 1", 0, "TracerPlaneExplosion");

	} else  if (%col.getMaterialInfo() $= "metal") {

		spawnExplosion(%pos, "0 0 1", 0, "TracerMetalExplosion");

etc.