Archived

This topic is now archived and is closed to further replies.

mickey

interpolation help, when s = 0.0 source, s = 1.0, end, want constant speed...

Recommended Posts

mickey    100
hi, i'm using dx function to do it for me, D3DXVec3Lerp(D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, FLOAT s); where v1 is source, v2 end, s is the value dx used to interpolate between this vector i wanted to give my character a speed, say 10.0f, and no matter how far it travels, it moves at a constant speed, i made this one up but am not sure if it's right though it's kinda do the job, // init vNextPos = vPickRayEnd; vCurPos = m_PlayerObject.GetPos(); D3DXVECTOR3 vDist = vNextPos - PlayerInfo.vCurPos; fDistance = D3DXVec3Length(&vDist); // when moving s += (character_speed / fDistance) * m_fElapsedTime; i'd like to specify a speed per second in world units, ie, 50.0f per secs. thanks, [edited by - mickey on January 30, 2003 4:14:13 AM]

Share this post


Link to post
Share on other sites