News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 13th Jun 2003, 07:39 PM   #1
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
Sarcastic My LEANING woes

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;
}
hocaltar is offline   Reply With Quote
Old 15th Jun 2003, 12:30 AM   #2
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
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.

__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Old 15th Jun 2003, 06:37 PM   #3
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
Hmmm... Ill give that a go. thanks
hocaltar is offline   Reply With Quote
Old 16th Jun 2003, 04:19 AM   #4
Payback
Ive got a big stick
 
Payback's Avatar
 
Join Date: Nov. 21st, 2002
Posts: 94
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/
Payback is offline   Reply With Quote
Old 16th Jun 2003, 04:39 AM   #5
SoSilencer
Harry Goz (1932 - 2003)
 
SoSilencer's Avatar
 
Join Date: Nov. 27th, 2000
Posts: 834
I still want to know how you are handling collision for a player who is leaning.
__________________
German Guy: Is there an indicator to see where the blue flag is?
Mark Rein: Yeah it's a blue flag
SoSilencer is offline   Reply With Quote
Old 16th Jun 2003, 02:44 PM   #6
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
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.
hocaltar is offline   Reply With Quote
Old 16th Jun 2003, 04:10 PM   #7
Lews
Breaker of the world
 
Lews's Avatar
 
Join Date: Oct. 19th, 2002
Location: Netherlands
Posts: 23
Afaik, the collision cyllinder *always* remains upright, no matter what you do to the mesh.
__________________
[Legend of the Serilim MOD]
Lews is offline   Reply With Quote
Old 17th Jun 2003, 12:16 AM   #8
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
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 is offline   Reply With Quote
Old 17th Jun 2003, 02:07 AM   #9
Mychaeel
 
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
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.
Mychaeel is offline   Reply With Quote
Old 17th Jun 2003, 08:36 AM   #10
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
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?
hocaltar is offline   Reply With Quote
Old 17th Jun 2003, 08:40 AM   #11
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
Depends on how you did the fast trace function. It may be facing the wrong rotation or location? Show us some code...
__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Old 17th Jun 2003, 08:45 AM   #12
Mychaeel
 
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
Quote:
Originally Posted by hocaltar
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.
Mychaeel is offline   Reply With Quote
Old 18th Jun 2003, 06:30 AM   #13
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
Sorry about the delay, working so much is killing me

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 is offline   Reply With Quote
Old 18th Jun 2003, 08:11 PM   #14
hocaltar
Registered User
 
hocaltar's Avatar
 
Join Date: Oct. 20th, 2002
Posts: 13
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 by hocaltar; 18th Jun 2003 at 09:37 PM.
hocaltar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:14 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer