I'm posting it here just in case Florida is flooded due to global warming, and I somehow manage to survive after days of clinging to a rotting alligator carcass and eating dead lizards, I won't have to then, on top of adjusting to my new life in Georgia, figure this out again. Also, someone else may find it useful.
Code: Select all
void FaceTarget( const CSiVector &v )
{ if ( !m_pObj ) return;
irr::core::vector3df rot, dif = m_pObj->getPosition() - v.v;
rot.Y = atan2( dif.X, dif.Z ) * 180.f / irr::core::PI;
rot.X = -atan2( dif.Y, sqrt( dif.X * dif.X + dif.Z * dif.Z ) ) * 180.f / irr::core::PI;
m_pObj->setRotation( rot );
}