I am creating my own weapon and projectiles derived from UTWeapon and UTProjectile, and want to add some special behaviors when the projectile hits something. I planned to do this by overriding "simulated function ProcessTouch " , but for some reason it never gets called. Neither does Touch or hitwall. I found another post where a person had a simlar problem, but for collision with bots. The problem was solved by adding CollideActors=true. So i attempted to add set all hit condition flags to true, but no change in behavior. Perhaps someone more knowledgable in this field could point me in the right direction?
bCollideWorld=true
bProjTarget=True
bBlockActors=true
CollideActors=true
bProjTarget=True
Thank you for taking the time to read my question.
bCollideWorld=true
bProjTarget=True
bBlockActors=true
CollideActors=true
bProjTarget=True
Thank you for taking the time to read my question.
Code:
class ARProj_Mudbomb extends UTProjectile;
/**
* Set the initial velocity and cook time
*/
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
SetTimer(2.0+FRand()*0.5,false); //Bomb begins unarmed
RandSpin(100000);
}
function Init(vector Direction)
{
SetRotation(Rotator(Direction));
Velocity = Speed * Direction;
TossZ = TossZ + (FRand() * TossZ / 2.0) - (TossZ / 4.0);
Velocity.Z += TossZ;
Acceleration = AccelRate * Normal(Velocity);
}
/**
* Explode
*/
simulated function Timer()
{
Explode(Location, vect(0,0,0));
}
/**
* Give a little bounce
*/
simulated event HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp)
{
bBlockedByInstigator = true;
`Log("MudBomb Process touch called");
if ( WorldInfo.NetMode != NM_DedicatedServer )
{
PlaySound(ImpactSound, true);
}
// check to make sure we didn't hit a pawn
if ( Pawn(Wall) == none )
{
Velocity = 0.75*(( Velocity dot HitNormal ) * HitNormal * -2.0 + Velocity); // Reflect off Wall w/damping
Speed = VSize(Velocity);
if (Velocity.Z > 400)
{
Velocity.Z = 0.5 * (400 + Velocity.Z);
}
// If we hit a pawn or we are moving too slowly, explod
if ( Speed < 20 || Pawn(Wall) != none )
{
ImpactedActor = Wall;
SetPhysics(PHYS_None);
}
}
else if ( Wall != Instigator ) // Hit a different pawn, just explode
{
Explode(Location, HitNormal);
}
}
/**
* When a grenade enters the water, kill effects/velocity and let it sink
*/
simulated function PhysicsVolumeChange( PhysicsVolume NewVolume )
{
if ( WaterVolume(NewVolume) != none )
{
Velocity *= 0.25;
}
Super.PhysicsVolumeChange(NewVolume);
}
simulated event CreateProjectileLight()
{
ProjectileLight = new(Outer) ProjectileLightClass;
AttachComponent(ProjectileLight);
}
simulated function ProcessTouch(Actor Other, vector HitLocation, vector HitNormal)
{
local ARProj_Fireball ShockProj;
`Log("MudBomb Process touch called");
Super.ProcessTouch(Other, HitLocation, HitNormal);
// when shock projectiles collide, make sure they both blow up
ShockProj = ARProj_Fireball(Other);
if (ShockProj != None)
{
ShockProj.Explode(HitLocation, -HitNormal);
}
}
event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
}
defaultproperties
{
ProjFlightTemplate=ParticleSystem'VH_Scorpion.Effects.P_Scorpion_Bounce_Projectile'
ProjExplosionTemplate=ParticleSystem'VH_Manta.Effects.PS_Manta_Up_Boost_Jump'
Speed=350
MaxSpeed=450
MaxEffectDistance=7000.0
bCheckProjectileLight=true
ProjectileLightClass=class'UTGame.UTShockBallLight'
Damage=55
DamageRadius=120
MomentumTransfer=70000
MyDamageType=class'UTDmgType_ShockBall'
LifeSpan=8.0
bCollideWorld=true
bProjTarget=True
bBlockActors=true
CollideActors=true
bProjTarget=True
CustomGravityScaling=0.8
CheckRadius=70.0
bCollideComplex=false
Physics=PHYS_Falling
bBounce=true
Begin Object Name=CollisionCylinder
CollisionRadius=30
CollisionHeight=30
AlwaysLoadOnClient=True
AlwaysLoadOnServer=True
BlockNonZeroExtent=true
BlockZeroExtent=true
BlockActors=true
CollideActors=true
End Object
TossZ=+245.0
bNetTemporary=false
//AmbientSound=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_AltFireTravelCue'
ExplosionSound=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireImpactFizzle_Cue'
}