Example #1
0
	void Muzzleflasher::updateMuzzleflash(IPointableObject *unit, VisualObject *muzzleflash, const std::string &name, const std::string &helper, const VC3 &pos, const VC3 &scale)
	{
		game::Unit *u = (game::Unit *)unit;

		VisualObject *vo = u->getVisualObject();
		if (vo == NULL || vo->getStormModel() == NULL)
		{
			return;
		}

		IStorm3D_Model_Object *object = vo->getStormModel()->SearchObject(name.c_str());
		if(object == NULL)
		{
			// didn't find it - add it
			createMuzzleflash(unit, muzzleflash, name, helper);
			object = vo->getStormModel()->SearchObject(name.c_str());
			if(object == NULL)
			{
				return;
			}
		}

		object->SetPosition(pos);
		object->SetScale(scale);
		//object->SetRotation(rot);
	}