Yes. It's a good habit to initialize any pointer immediately when declaring it, either to NULL or to a valid address. This can save you tons of headaches.

To make your code absolutely bullet proof you should also check mouse_dir3d.z before dividing by it. It could be zero and hence cause a division by zero error. It's not that this is very likely but you never know... ;-)


Always learn from history, to be sure you make the same mistakes again...