Up arrow Forwards Down arrow Backwards Left arrow Turn left (anti-clockwise) Right arrow Turn right (clockwise) SEE FULL VERSION: https://scratch.mit.edu/projects/115065611/
This is the base for a completely re-written 3D engine :D My latest tests show that this new engine is 85% faster! How it works: Each shape is stored as a series of walls. Each wall has a start point, end point and an angle. First, we calculate the angle from the camera to the start and end points of the wall. Then, we calculate the distance from the camera to the start and end points of the wall. We can then use this information to calculate the distances between the camera and all the points along the wall (using the sine rule). The distances are stored in a list (the z buffer) and only the shortest distances ever gets stored for each angle. Thanks to @WO997 for a lot of helpful advice!