My LEANING woes

  • 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.

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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;
}
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
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:
 

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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
 

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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.
 

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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?
 

Mychaeel

New Member
hocaltar said:
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.
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.
 

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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;

}
 

hocaltar

New Member
Oct 20, 2002
13
0
0
Visit site
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: