You have to convert it to World Coordinates: VectorTransform( vecLocalOrigin, EntityToWorldTransform(), vecResultOrigin);
On Fri, Sep 25, 2009 at 7:35 PM, Ryan Sheffer <[email protected]> wrote: > I guess all I can say is if the GetBonePosition function is returning the > local origin instead of the offset from the global origin. > > And I was thinking something like, > > vector v_direction = NewBoneOrigin - PreviousBoneOrigin; > float length_moved = v_direction.Length2D(); // I dont remember the > magnitude function, its something like Length2D. > > Then you have a distance traveled plus a direction of movement which you > could clamp how you see fit. > length_moved could be used to determine a velocity for that frame. > > On Fri, Sep 25, 2009 at 1:07 AM, Michael Chang <[email protected] > >wrote: > > > > > > > Micheal, as you know I'm doing something rather similar. I've gotten it > > > working reasonably well, but in truth I don't like the way I have it > > > working. It's laggy and a bit jumpy, and plays terribly for players > with > > > latency more than 50. But I can basically show you how it works, here's > > the > > > abridged version: > > > > > > > Jorge: > > Dude thanks again for sharing the code. Much appreciated. > > > > I've spent a good deal of time trying to get this to work the way I want. > > There seems to be some oddities with GetIntervalMovement. When I print > out > > the deltas for newPosition - GetLocaPosition(), what appears to be > > happening > > is that > > > > 1. When I'm not moving, the deltas are incorrect and extremely small. > > 2. When I'm pressing +forward the deltas are correct and the player > > animates > > correctly. > > > > What's the relationship with GetIntervalMovement and user commands? I've > > traced all the lines of code with Studio_Seq stuff and nothing seems to > > care > > about current speed or input. I'm at a total loss as to why > > GetIntervalMovement would return different things based on whether or not > > I'm trying to move!! > > > > > > > > You could get a bone position (spine bone perhaps) and save that, and > frame > > > by frame compare the distance the bone traveled to get a velocity from > > that > > > and apply it to the player. Maybe this isn't what you want thought. ;) > > > > > > > > Ryan: > > > > I spent about a minute sketching this out not expecting it to work and > not > > surprisingly it didn't. > > > > int boneNum = player->LookupBone("ValveBiped.Bip01_Pelvis"); > > if(boneNum==-1) > > return; > > > > Vector bonePos; > > QAngle boneAngle; > > player->GetBonePosition(boneNum, bonePos, boneAngle); > > > > if(lastBonePos == vec3_origin){ > > lastBonePos = bonePos; > > return; > > } > > > > Vector delta = bonePos-lastBonePos; > > mv->m_vecVelocity = delta/gpGlobals->frametime; > > lastBonePos = bonePos; > > > > What would be the right approach to this? This doesn't seem right at all. > > > > > > Thanks for your patience guys. I guess I'm trying to do something that's > > not > > very common in Source so there's not much documentation on this at all :| > > > > ~M > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > -- > ~Ryan ( skidz ) > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

