Author Topic: Projectile switch onCollision code doesn't work anymore  (Read 682 times)

This block of code isn't working anymore and I don't know why. It used to work in V8

Code: [Select]
function SensorFusedLProjectile::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
   if(%col.getClassName() $= "Player")
%obj.setDataBlock(PlaySensorFusedLProjectile);
   else if(%col.getClassName() $= "WheeledVehicle")
%obj.setDataBlock(VehiSensorFusedLProjectile);
   else if(%col.getClassName() $= "AiPlayer")
%obj.setDataBlock(PlaySensorFusedLProjectile);
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
}

I have all 3 type of projectile, there are no console errors when I load it. But, the projectiles don't switch on collision with vehicles or players so it's not doing anything. Can anyone help me out?

I don't think you can change datablocks of projectiles.

Try recreating it?