adding velocities ...

  • 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.
I just made a mover that a player can stand on that goes pretty fast, but when i jump i get left far behind, and when i fire a rocket forward it flies back in my face.

So it looks to me like the player's velocity is not affected by the velocity of the mover, and in turn i don't know whether the rocket's velocity is affected by the player's velocity since the player's velocity isn't correct.

Anyone know how to make these velocites add to each other the way they should? I didn't see an obvious place in the mover code for it, and it's not a custom gametype so i can't modify the players themselves any ...
 

Kangus

Zombie on your pwn!
Jan 29, 2001
978
0
16
Illinois, USA
www.planetunreal.com
well, the DoJump function in playerpawn only adds the Z (vertical) velocity of the player's base (whatever they are standing on) when called.
Also, the player's velocity does not affect the rocket's velocity with the default UT rocket launcher at all. Its not coded to.

I don't know much about mover code, but you might be able to solve the problem with a new zone type that changes its gravity (x, y or Z) when triggered (at the same time the mover is triggered of course).
 
well the mover's not at a constant velocity the whole time, plus there are other problems ....

hmmm ...

I'm wondering about the feasibility of putting some code in the mover's Timer() function along the lines of:

local Pawn P;

if ( StandingCount > 0 )
for ( P=Level.PawnList; P!=None; P=P.nextPawn )
if ( P.Base == self )
{
P.SomethingToAffectVelocity();
}


but i'm not sure what i can do to affect the pawn's velocity or if this approach would have unseen nasty side effects in network play ...

If i just did P.Velocity += Velocity type of thing it would just keep ramping up the pawn's velocity, so that won't work ....
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
What about:

if ( P.Physics != PHYS.Falling ) // If they're falling and thus have jumped
{
P.AddVelocity ( Velocity ); // Add the velocity of the mover to the foo's jump velocity
}

Not sure if you need vect or vector in front of Velocity. I can never remember that.
 
Interesting you mention that i tried something very similar a while ago. Every second (in mover's Timer() ) i called the pawns addvelocity and added the mover velocity (and addvelocity itself sets the pawn's physics to falling) ... but it didn't have any effect at all. I thought for sure it would keep adding the mover's velocity to the pawn's velocity resulting in some insane velocity for the pawn.

But as i ride on the mover, nothing's any different than normal, and when i jump up, i go straight up, with no horizontal velocity whatsoever. I starting to think the game code itself ignores anything but z velocity when you jump; i guess it took jumping from a very fast mover to make me realize it.

I'm still looking for a way to make this work however ;)
 
Hey i got it working! The Inventory actor has a OwnerJumped() function so i added it to a subclass i made of TournamentPickup and put a trigger around each PlayerStart that gives the player a copy of it. Then i added this function:

function OwnerJumped()
{
local Pawn PawnOwner;

PawnOwner = Pawn(Owner);
if ( (PawnOwner.Base != Level) && (PawnOwner.Base != None) )
{
PawnOwner.Velocity.X += PawnOwner.Base.Velocity.X;
PawnOwner.Velocity.Y += PawnOwner.Base.Velocity.Y;
}


I guess my question now is am i causing any unforeseen problems by adding an extra inventory item to the player, and if i wanted to investigate your Detached() approach to compare to this one would i be using the mover's Detach function?