Partial solution to project's problem 3d

Still has bugs, but at least it compiles. Will hopefully come back to
it later to completely finish it.