fixed obstacle creation method. Should be working now but needs some more changes and testing.