1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Scaling movement in directions...

Discussion in 'Programming' started by Hazard.ep, Mar 2, 2006.

  1. Hazard.ep

    Hazard.ep New Member

    Joined:
    Oct 7, 2003
    Messages:
    166
    Likes Received:
    0
    This input and movement code in playercontroller looks still pretty much confusing to me, and its not easy to modify, too. I wondered whether there is a way to scale movement in different directions. So I want my pawn to run forward at 100% GroundSpeed, sidewards at 80% GroundSpeed and backwards at 60% GroundSpeed. Any ideas on how to do that?
     
  2. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    798
    Likes Received:
    3
    Here is the hacky method I developed for slowing the strafing speed. You should be able to mangle this enough to get something at least close to what you're looking for. This works online as well.
    Code:
    
    class TDPawnSpec extends xPawn;
    
    const STRAFESPEEDLIMIT =0.5;
    
    simulated event ModifyVelocity(float DeltaTime, vector OldVelocity){
         local vector x, y, z, dir;
         local float Yspeed, cosAngle, MaxStrafeSpeed;
    
         if(Physics==PHYS_Walking){
             GetAxes(getViewRotation(), x, y, z);
             MaxStrafeSpeed = GroundSpeed * STRAFESPEEDLIMIT;
             Yspeed = abs (y dot Velocity);// the magnitude of the component of velocity in the direction of strafing
             if(Yspeed > MaxStrafeSpeed){
                //log("limiting Strafe!");
                dir=Normal(Velocity);
                cosAngle = abs(y dot dir); // the cosine of the angle between them, cosine = adjacent/hypotenuse, we want the "adjusted" hypotenuse
                //Yspeed = Fmin(Yspeed, MaxStrafeSpeed);
                velocity= dir*(MaxStrafeSpeed/cosAngle);
             }
         }
    }
    
     
    Last edited: Mar 2, 2006
  3. whelkgod

    whelkgod New Member

    Joined:
    Feb 18, 2006
    Messages:
    50
    Likes Received:
    0
    Would you be able to make this movement modification in a separate mutator to change all players movement (strafe, fowards, and backwards with the percentages u said)?
     
    Last edited: Mar 3, 2006
  4. meowcat

    meowcat take a chance

    Joined:
    Jun 7, 2001
    Messages:
    798
    Likes Received:
    3
    @whelkgod: you could, but only by replacing the pawn class. You should really only replace the pawn class in a TC mutator or mod because it can break compatibilty with other mutators really easily.
     
  5. whelkgod

    whelkgod New Member

    Joined:
    Feb 18, 2006
    Messages:
    50
    Likes Received:
    0
    How big in file size would a mutator like this be? Would you be able to make it? I have little knowledge of mutators and coding.
     
    Last edited: Mar 4, 2006
  6. Hazard.ep

    Hazard.ep New Member

    Joined:
    Oct 7, 2003
    Messages:
    166
    Likes Received:
    0
    @meowcat: thx again. appears hacky to me,too, but works totally fine in my case. also managed the backwards move scaling in this way, that now allows for more tactical melee combat in CasterMod.

    @whelkgod: this mutator would be very small in filesize. i have to agree to meowcat, that it would be incompatible with many other mutators or mods, but if I have some time left I'll do it and post it here, should be no big deal...
     
  7. whelkgod

    whelkgod New Member

    Joined:
    Feb 18, 2006
    Messages:
    50
    Likes Received:
    0
    Sweet thanks man! Sorry to be a bother but could u make a 2nd movement scaling mut that also has no double jumps and about half the air control (%40) if air control has anything to do with the Xpawn class.
    Thanks again.

    Edit: Um would this be compatible with a fall damage mutator (Makes damage occur with smaller falls) and the Rpg mutators?
     
    Last edited: Mar 4, 2006
  8. Hazard.ep

    Hazard.ep New Member

    Joined:
    Oct 7, 2003
    Messages:
    166
    Likes Received:
    0
    Mutator is attached, sorry, but I'm just to busy to include the other stuff. This mut can scale strafe and backwards movement in range from 0.5 to 1.0 each. My tests showed, that below 0.5 massive problems occured and that above that (obviously because of the algorithm) nothing happened. So this is just for demonstration and anyone who needs other ranges will have to modify it.

    @whelkgo: I don't know about fall damage but I' m pretty sure that RPG muts use their own pawn class and are therefore incompatible.
     

    Attached Files:

    Last edited: Mar 9, 2006
  9. whelkgod

    whelkgod New Member

    Joined:
    Feb 18, 2006
    Messages:
    50
    Likes Received:
    0
    Thanks Hazard!

    edit: actually seems to run fine with rpg mut and definately works fine with the fall mut.
     
    Last edited: Mar 10, 2006

Share This Page