This needs to be a bit more robust.  

obj.mex_model_ptr can == 0, if drake is using a minimal build.  
collisionRaycastmex might not exist, even if obj.mex_model_ptr is valid (e.g. compiled with dynamics but without bullet)
i would recommend adding a checkDependency('bullet') to the top of the file, and throwing an error if obj.mex_model_ptr == 0.