![]() |
|
|
#1 |
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;
}
|
|
|
|
|
|
|
#2 |
|
First of all, here is your problem
Code:
r.Pitch = -10000;
SetBoneDirection('spine',r);
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.
|
|
|
|
|
|
|
#3 |
|
Hmmm... Ill give that a go. thanks
|
|
|
|
|
|
|
#4 |
|
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 |
|
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 |
|
|
|
|
|
|
#6 |
|
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.
|
|
|
|
|
|
|
#7 |
|
Afaik, the collision cyllinder *always* remains upright, no matter what you do to the mesh.
__________________
[Legend of the Serilim MOD] |
|
|
|
|
|
|
#8 |
|
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 |
|
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.
|
|
|
|
|
|
#10 |
|
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 |
|
Depends on how you did the fast trace function. It may be facing the wrong rotation or location? Show us some code...
|
|
|
|
|
|
|
#12 | |
|
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
|
Quote:
Also, check the comment next to the declaration of FastTrace in class Actor. It explains the meaning of its return value. |
|
|
|
|
|
|
#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;
}
|
|
|
|
|
|
|
#14 |
|
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. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|