• Advertisement


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

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

This topic is 5526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

  • Advertisement