Re: [Plib-users] 'World' to 'Local' body velocity transform
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2001-12-03 05:23:58
|
"McEvoy, Nick" wrote: > > I finally have to admit my knowledge of matrix math is very bad !!! :-( > > I have been struggling with this 'simple' problem for a few days now ... and > it is driving me crazy ! > > Say, I have a 'Body' travelling with a given 'world' velocity and a HPR. As > the 'Body' changes HPR I want to know what the velocity is in relation to > the 'bodies local axis' (by this I mean assume the body is facing +ve Y > direction, +ve Z up, +ve X right ... local coords not world coords) ... (I > hope this makes sense). So (in a nutshell) you want to transform the world-coordinate velocity into 'body' coordinates. You know (or can easily construct) the matrix that converts 'body' coordinates into 'world' by creating a matrix from the current hpr. All you need to do is to 'invert' that matrix which switches it from being a "body-to-world" matrix into a "world-to-body" matrix which you can apply to the world velocity to turn it into a body velocity. > MORE EXPLANATION ... The whole reason why I want to do this is to apply a > damping force to my 'Body' in (xz) directions normal to its +y heading (at > some ratio to the velocity in these normal directions) ... So, once you have the veloity in body coordinates, you can simply multiply the X/Z coordinates by some number a little less than 1.0 every frame and that will damp it nicely. > HELP ANY SUGGESTIONS PLEASE (I wish I paid attention in high-school math) Yes - me too. Matrix math isn't hard though - did you read this yet? http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |