Hey, I can't figure out how in the world to get object rotation, but I got inertial rotation down, I was wondering if anyone could explain it better? heres my rotation code on the y axis for inertial (yrot being the value, _Matrix is a member variable for the current rotation) and I wrote it all by hand, so it might be a little unfamiliaure
void MeshObject::RotateY(float roty){
for (unsigned int i=0;i<_verts.size();++i){
sf::Vector3<float> transform( _verts[i].x - _Position.x, _verts[i].y - _Position.y, _verts[i].z - _Position.z );
_verts[i] = transform;
}
float cosy = cos(roty);
float siny = sin(roty);
sf::Vector3<float> XMatrix(cosy,0,-siny);
sf::Vector3<float> ZMatrix(siny,0,cosy);
sf::Vector3<float> XMtransform((XMatrix * _XMatrix.x) + (ZMatrix * _XMatrix.z) + sf::Vector3<float>(0,_XMatrix.y,0));
sf::Vector3<float> ZMtransform((XMatrix * _ZMatrix.x) + (ZMatrix * _ZMatrix.z) + sf::Vector3<float>(0,_ZMatrix.y,0));
_XMatrix = XMtransform;
_ZMatrix = ZMtransform;
for (unsigned int i=0;i<_verts.size();++i){
sf::Vector3<float> transform((XMatrix * _verts[i].x) + (ZMatrix * _verts[i].z) + sf::Vector3<float>(0,_verts[i].y,0));
_verts[i] = transform;
}
for (unsigned int i=0;i<_verts.size();++i){
sf::Vector3<float> transform( _verts[i].x + _Position.x, _verts[i].y + _Position.y, _verts[i].z + _Position.z );
_verts[i] = transform;
}
}