UE3 - UDK Dash 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.

hugito00

New Member
Dec 4, 2013
2
0
0
I'm trying to make a my PlayerPawn move a fixed distance on the X axis but I'm having some trouble getting this value to be a little precise...

I tried using the Tick function in the Pawn to check if the distance were reached already but it never moved the same distance before stopping...

Any ideias how to do this? Matinee maybe? I'm running out of ideas...

Code:
function bool DashStart(vector Dir)
{
	dashStartPos = Location;
	
	bDashing = true;
	
	Velocity = DashSpeed*Dir;
	return true;
}


Code:
simulated function Tick(float DeltaTime)
{
	super.Tick(DeltaTime);

	if(bDashing)
	{
		if(Abs(dashStartPos.X - Location.X) >= DashDistance) {
			bDashing= false;
                        Velocity.X = 0;
			`log(Abs(dashStartPos.X - Location.X));
		}
	}
}

but analysing the results from the `log(Abs(dashStartPos.X - Location.X)); my pawn wasnt moving DashDistance... it was moving anything above DashDistance. I couldn't get anything more precise than this. ; (
 
Last edited:

EvilT-ModZ

Un-Gravitify
Aug 3, 2011
42
0
6
30
Russia
www.set-games.ru
I'm trying to make a my PlayerPawn move a fixed distance on the X axis but I'm having some trouble getting this value to be a little precise...

I think, you should use full coordinates and set the direction (as rotation)

Code:
function bool DashStart(vector Dir)
{
	local rotator DirectionRot;//moving direction
	dashStartPos = Location;

	bDashing = true;

	Velocity = DashSpeed * vect(1,0,0) >> DirectionRot;

	SetRotation(DirectionRot);

	return true;
}

simulated function Tick(float DeltaTime)
{
	super.Tick(DeltaTime);

	if(bDashing)
	{
		if(VSize(dashStartPos - Location) >= DashDistance)
		{
			bDashing = false;
			Velocity = vect(0,0,0);
			log(VSize(dashStartPos - Location));
		}
	}
}

It also can move along X axis
 

hugito00

New Member
Dec 4, 2013
2
0
0
erm, that could also work but as I'm doing a sidescroller game I don't see why I would do that ;x

I just need the movement on the X axis.