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.

My LEANING woes

Discussion in 'Programming' started by hocaltar, Jun 13, 2003.

  1. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Alright I finally got my interaction to work as well as some of my leaning code. The problems are:

    1st, and most important. Depending on which way I am facing inside the game I lean a different direction. Ie. If i am facing north Ill lean to the east. But if I am facing south i will also lean to the east. I dunno what function to call to fix this I though maybe put GetViewRotation() inside of my GetAxes function, but that was a bust.

    2: I am not good with vector math. I want to call FastTrace what is the algorithm for stopping the trace at a given location? IE. I want to check if I am too close to a WALL TO LEAN.

    any help is appreciated, here is my code snippet.

    Code:
    simulated function LeanRight()
    {
        local vector X,Y,Z, TraceStart;
        local vector TraceEnd;
        local rotator r;
    
        GetAxes(Rotation,X,Y,Z);
        TraceEnd = -X;
    
       TraceStart = Location + (default.EyeHeight + Default.CollisionHeight - CollisionHeight) * vect(0,0,1);
       TraceEnd = EyeHeight * Vect(-128,0,1) + walkbob;
    
       if(FastTrace(TraceEnd, TraceStart))
       {
       log("we hit world geometry");
       return;
       }
    
        r.Pitch = -10000;
    
        SetBoneDirection('spine',r);
        bIsLeanedRight = true;
        return;
    }
    
    
     
  2. [SAS]Solid Snake

    [SAS]Solid Snake New Member

    Joined:
    Jun 7, 2002
    Messages:
    2,633
    Likes Received:
    0
    First of all, here is your problem

    Code:
    r.Pitch = -10000;
    SetBoneDirection('spine',r);
    
    When you do this, you have NOT adjusted for the Players Spine rotation to begin with. Basically you have told the bone 'Spine' to set itself, to a rotational value of (Roll=0,Pitch=10000,Yaw=0). This is probably why you are seeing problems.

    What you should do instead is to get the values of the Spine rotation, and then adjust the pitch of that value. Hope that helps.

    :rolleyes:
     
  3. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Hmmm... Ill give that a go. thanks
     
  4. Payback

    Payback Ive got a big stick

    Joined:
    Nov 21, 2002
    Messages:
    94
    Likes Received:
    0
    Im 90% sure you dont need to worry about grabbing the spines rotation. Just use SetBoneRotation rather than SetBoneDirection. This page even shows sort of what you are trying (except the player leans forward/back rather than left/right)

    http://udn.epicgames.com/pub/Technical/UWSkelAnim2/
     
  5. SoSilencer

    SoSilencer Harry Goz (1932 - 2003)

    Joined:
    Nov 27, 2000
    Messages:
    834
    Likes Received:
    0
    I still want to know how you are handling collision for a player who is leaning.
     
  6. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Collision is actually giving tons of problems. My understanding of vectors is very limited. I fast going to use the fastTrace(x,y) function and see if I could get it to detect world geomotry within 2 feet of me, but I have had no luck with it. It doesnt appear to work at all. The way epic set their fasttrace function up in their Dodge function it doesnt appear to work at all?

    Anyone have any other good suggestions to handle collisions while leaning? I think I am gonna end up scrapping leaning; although, I got sliding to work awesomely. :D
     
  7. Lews

    Lews Breaker of the world

    Joined:
    Oct 19, 2002
    Messages:
    23
    Likes Received:
    0
    Afaik, the collision cyllinder *always* remains upright, no matter what you do to the mesh.
     
  8. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Yeah, I understand that. Modifying the bones direction or rotation is independent of the collision cylinder. That is not my problem. My problem is, detecting geomotry to left or right of me. Does anyone have a good way to do this.
     
  9. Mychaeel

    Mychaeel New Member

    Joined:
    Oct 3, 2001
    Messages:
    3,830
    Likes Received:
    0
    The usual way of detecting geometry is making a FastTrace (declared in Actor) from a point where you know you're clear into the direction you want to detect geometry at.
     
  10. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Yes, I tried that. But if you look at the way epic set up the code for Function bool dodge(edoubleclick doubleclickdirection) there is a fast trace function in there. But it doesnt work! test it, open up a deathmatch game, and stand next to a wall and try to dodge forward into that wall. If the fasttrace() worked the function would return without any movement(s). Or am i completly off the ball?
     
  11. [SAS]Solid Snake

    [SAS]Solid Snake New Member

    Joined:
    Jun 7, 2002
    Messages:
    2,633
    Likes Received:
    0
    Depends on how you did the fast trace function. It may be facing the wrong rotation or location? Show us some code...
     
  12. Mychaeel

    Mychaeel New Member

    Joined:
    Oct 3, 2001
    Messages:
    3,830
    Likes Received:
    0
    That code is for wall-dodges. If you look at the code more closely you'll see that it it is only executed when you're in physics mode PHYS_Falling, that is, during a jump.

    Also, check the comment next to the declaration of FastTrace in class Actor. It explains the meaning of its return value.
     
  13. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Sorry about the delay, working so much is killing me :mad:

    anywho here is the code snippet. OH! and i know -X is tracing forward, I am just testing :)

    Code:
    simulated function LeanRight()
    {
        local vector X,Y,Z, TraceStart;
        local vector TraceEnd;
        local rotator r;
    
        GetAxes(Rotation,X,Y,Z);
    
        TraceEnd = -X;
    
        TraceStart = Location - CollisionHeight*Vect(0,0,1) + TraceEnd*CollisionRadius;
        TraceEnd = TraceStart + TraceEnd*16.0;
    //    local name Anim;    //used for leaning animations should I want to put them in
    
       if(FastTrace(TraceEnd, TraceStart))
       {
       log("we hit world geometry");
       return;
       }
        //r.Yaw = 10000;
        r.Yaw = 5000;
    
        SetBoneRotation('spine',r);
        bIsLeanedRight = true;
        return;
       // Anim = WallDodgeAnims[0];
      // Anim = WallDodgeAnims[0];
                //if ( PlayAnim(Anim, 1.0, 0.1) )
      //          if ( PlayAnim(Anim, 1.0, 0.1) )
      //              bWaitForAnim = true;
      //              AnimAction = Anim;
    
    }
    
    
     
  14. hocaltar

    hocaltar New Member

    Joined:
    Oct 20, 2002
    Messages:
    13
    Likes Received:
    0
    Hmmm... Still not working exactly right. :(

    [edit] I just dont get it. That fasttrace function sometimes works and sometimes doesnt. It is definitly not working the way it should :(
     
    Last edited: Jun 18, 2003

Share This Page