Phil Jones' pitch and roll example

Blitz3D Forums/Blitz3D Programming/Phil Jones' pitch and roll example

Only issue with one linepick is that it's less accurate on more detailed uneven ground


That's right, it will be aligning your entity to a single normal rather than taking an average of the 4 wheels, so it will be less accurate if (for example) you put the entity over the top of a small lump or hanging over the edge of an incline.

If the entity is constantly moving or the groundmesh is reasonably smooth then it shouldn't be too much of an issue.

I use a smoothing system on mine - I use the above code to obtain the "target" normal on each program loop, and then smoothly move the actual orientation of the entity towards this target rather than using an instant snap.

I imagine for a boat on water a fairly gentle (ie. slower) smoothing would give a nice effect of mass as it cuts into the water before bobbing upright. For entities over ground you need a quicker smoothing otherwise they dig into the floor or appear to be made of jelly.