LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   JA Coding (http://www.lucasforums.com/forumdisplay.php?f=539)
-   -   Why can't bone angles be adjusted by value of variables?? (http://www.lucasforums.com/showthread.php?t=167809)

Vruki Salet 07-20-2006 04:32 PM

Why can't bone angles be adjusted by value of variables??
 
I'm messing with setting bone angles in BG_G2PlayerAngles and a weird thing happens.

This doesn't work:

Code:

static vec3_t rhangAngle;
float p = 20.0f;

VectorCopy(vec3_origin, rhangAngle);
rhangAngle[PITCH] +=  p;

--snip irrelevant if(){} for being in a vehicle--

strap_G2API_SetBoneAngles(ghoul2, 0, "rhang_tag_bone", rhangAngle, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time);

This does:

Code:

static vec3_t rhangAngle;
float p = 20.0f;

VectorCopy(vec3_origin, rhangAngle);
rhangAngle[PITCH] +=  20.0f;

--snip irrelevant if(){} for being in a vehicle--

strap_G2API_SetBoneAngles(ghoul2, 0, "rhang_tag_bone", rhangAngle, BONE_ANGLES_POSTMULT, POSITIVE_X, NEGATIVE_Y, NEGATIVE_Z, 0, 0, time);

See the only difference is in the first I added "p" (float value of 20.0) to rhangAngle[PITCH] and in the second I just added a float of 20.0 directly.

What gives?

Vruki Salet 07-21-2006 12:42 AM

It turns out it was a problem involving the split between game and cgame and a failure of communication between them leading to my seeing something onscreen other that what the game was actually doing.

Anyone trying to deal with similar stuff is welcome to get in touch with me.

razorace 07-21-2006 03:13 PM

Yeah, getting both the cgame and game to work together is tricky for some of this stuff :) Good luck!

Vruki Salet 07-21-2006 05:28 PM

Thanks I got it. I was sending the playerstate data to s in the wrong place or wrong way but it works now. It sure is tricky because it's hard to know if what you do doesn't work at all or if it works on the server but doesn't show on the client.

ensiform 07-26-2006 03:34 PM

whats the difference between strap_G2API_SetBoneAngles and trap_G2API_SetBoneAngles ?

Vruki Salet 07-26-2006 05:01 PM

You tell me, heh. It looks like all those strap_ commands just return equivalent trap_'s. It says they're "shared" but i see that the plain trap_'s are used in cgame and game so...? The reason client wasn't showing my changes was because the variable p was set just to 20.0f in game so cgame thought it was 0, while of course an actual number had its own real value whereever it was.

I was just setting angles directly in BG_G2PlayerAngles, not with traps. (No it wasn't obvious at first, i'm still taking baby steps here.) If you like to try wacky stuff with bone angles, check out the IK stuff in the game. You can sort of retroactively set bone angles to make a particular point on the body try to reach a given point in the game world. Restraining the joints to natural looking positions is hard though.

razorace 07-26-2006 11:12 PM

Yep, that's the key reason why realistic IK is so difficult to pull off.


All times are GMT -4. The time now is 03:47 PM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.