I'm currently working on a pseud-bowling mod for school. I have the pins set up as karma actors and they're flying around fine when I shoot them with the link gun/shock rife/etc so that's fine. I've based my bowling ball off the assault rifle grenade projectile and I'm wondering how I could get the ball to explode only when it hits the 'pins'.
I've been thinking of setting the surface properties of the KActor and performing a check in there to trigger the explosion function but I think my code is off. What I have is (just cut part of it out where I added it . . it's the assault rifle grenade class): (set the kactor surface to flesh)
I added the if statement for SurfaceType but the ball is just bouncing off the thing. What am I doing wrong? Also if there's an easier way to just get a grenade to go off when hitting a certain surface (like the way it does when it hits a player) I'm open for suggestions.
Thanks!
I've been thinking of setting the surface properties of the KActor and performing a check in there to trigger the explosion function but I think my code is off. What I have is (just cut part of it out where I added it . . it's the assault rifle grenade class): (set the kactor surface to flesh)
Code:
simulated function HitWall( vector HitNormal, actor Wall )
{
local Vector VNorm;
local PlayerController PC;
if ( SurfaceType == EST_Flesh) /// attempting to check surface for flesh and explode
{
Explode(Location, HitNormal);
return;
}
if ( (Pawn(Wall) != None) || (GameObjective(Wall) != None) )
{
Explode(Location, HitNormal);
return;
}
if (!bTimerSet)
{
SetTimer(ExplodeTimer, false);
bTimerSet = true;
}
// Reflect off Wall w/damping
VNorm = (Velocity dot HitNormal) * HitNormal;
Velocity = -VNorm * DampenFactor + (Velocity - VNorm) * DampenFactorParallel;
RandSpin(100000);
DesiredRotation.Roll = 0;
I added the if statement for SurfaceType but the ball is just bouncing off the thing. What am I doing wrong? Also if there's an easier way to just get a grenade to go off when hitting a certain surface (like the way it does when it hits a player) I'm open for suggestions.
Thanks!