works weird,
my source:
//render D3DXMATRIX mpos, scale, rot; float posfactor = 10; if ( scaleFactor == 2000 ) posfactor = 10; D3DXMatrixTranslation ( &mpos, pos.x/posfactor, pos.y/posfactor, pos.z/posfactor ); D3DXMatrixRotationYawPitchRoll ( &rot, D3DXToRadian ( yaw ), D3DXToRadian ( pitch ), D3DXToRadian ( roll ) ); D3DXMatrixScaling ( &scale, fScale/scaleFactor, fScale/scaleFactor, fScale/scaleFactor ); WorldMatrix = scale * rot * mpos; MainCore->GetDevice()->SetTransform ( D3DTS_WORLD, &WorldMatrix ); D3DXVec3TransformCoord ( &right, &D3DXVECTOR3 ( 1, 0, 0 ), &WorldMatrix ); D3DXVec3TransformCoord ( &up, &D3DXVECTOR3 ( 0, 1, 0 ), &WorldMatrix ); D3DXVec3TransformCoord ( &look, &D3DXVECTOR3 ( 0, 0, 1 ), &WorldMatrix );//------void hxObject::Yaw ( float angle ){ yaw+= angle; while ( yaw > 360 ) yaw -= 360; while ( yaw < 0 ) yaw += 360;}void hxObject::Pitch ( float angle ){ pitch += angle; while ( pitch > 360 ) pitch -= 360; while ( pitch < 0 ) pitch += 360;}void hxObject::Roll ( float angle ){ roll += angle; while ( roll > 360 ) roll -= 360; while ( roll < 0 ) roll += 360;}void hxObject::Move ( float units ){ pos += look * units;}void hxObject::Strafe ( float units ){ pos += right * units;}void hxObject::Fly ( float units ){ pos += up * units;}
first off, if i use D3DXMatrixRotationYawPitchRoll, it works right ONLY if i yaw, pitch then roll in order, but if my object, for example, rolls before turning, the rotation goes wrong, so turning does not work at all
and moving is even worse, my object moves in the same curve whether i strafe, move or fly, and it cant move to positive positions ( curve is from 0 to -[INFINITY] )
i suppose my code is wrong? please correct me if it's wrong
also, i think i'll try that inverse thing, so i should use the exact same code as my camera for objects, but inverse the fine (view) matrix?