UE3 - UDK Help Regarding Bump Function

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

rckzilla

New Member
Apr 16, 2012
2
0
0
Okay Guys , this is my first post on this website.I am currently working on a project.

I have an Enemy class who chases my player when the player is within specified distance. When he gets within a certain distance his health decreases.However i want my player to get a bump effect when the enemy is attacking.So i used the bump function when they both collide.But i am not able to make it bump.Only the health gets deducted.

Here is my Code function in my Enemy class which extends UTPawn
Code:
simulated event Tick(float DeltaTime)
{
	local UTPawn gv;

	super.Tick(DeltaTime);
	MyController.Tick(DeltaTime); 

	foreach CollidingActors(class'UTPawn', gv, 200)
	foreach VisibleCollidingActors(class'UTPawn', gv, 100)
	{
		if(AttAcking && gv != none)
		{
			if(gv.Health > 0)
			{

				gv.Health -= 1;
				Bump(self,CollisionComponent,vect(0,0,0));
			}
		}
	}
}

Then i have Defined my Bump function as follows
Code:
event Bump(Actor other,PrimitiveComponent OtherComp, vector HitNormal)
{
TakeDamage(6,none,Location,vect(0,0,0),class'UTDmgType_LinkPlasma');
}
However this does not seem to work. Kindly help with your inputs guys
Thank you
 
Last edited by a moderator:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Bump is an event that gets called when the engine finds two actors are colliding and are not allowed to intersect. Note that if intersection is allowed (e.g. player walking over pickups), then Touch is generated instead. In either case, the event is called as a result of the collision and the necessary adjustments to prevent intersection during a bump have already been made. If you call Bump manually it's the same as if you called the function "HurrayIWasBumped" - it's a plain old function call that simply executes what you wrote inside the function.

If you want the damage to apply some force to the target actor, pass a non-zero momentum vector to TakeDamage. If you want the bump to apply force to the actor itself, adjust the actor's own Velocity.
 

Gord10

New Member
May 14, 2012
1
0
0
Also, putting a VisibleCollidingActors in a foreach CollidingActors(class'UTPawn', gv, 200) loop can cause performance drawbacks. Just VisibleCollidingActors could be sufficient.