News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 5th Sep 2010, 10:41 AM   #1
Endasil
Registered User
 
Join Date: Sep. 5th, 2010
Posts: 1
Arrow ProcessTouch not getting called

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.

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'
}
Endasil is offline   Reply With Quote
Old 6th Sep 2010, 01:11 PM   #2
brold9999
Registered User
 
Join Date: Apr. 5th, 2009
Posts: 142
I tried this code in UT3, and it worked*. I only get HitWall calls though, even if it hits a Pawn. With bBlockActors=false and BlockActors=false in the collision component, I get Touch, ProcessTouch, and HitWall.

* with references to ARProj_Fireball commented out.
brold9999 is offline   Reply With Quote
Reply

Tags
collision, projectiles, udk, weapons

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer