Stop Sliding down Slopes (SSS)

https://www.babylonjs-playground.com/#CIFSQS#4

I finally got the “quadLazers” working. See console… to see the distance samplings.

By constantly positioning (never rotating) this device… above a gravity-active freeCamera… we SHOULD be able to constantly know… what mesh-angle… our freeCam ellipsoid is always sitting-upon.

If you remember my previous post, I was getting unchanging 2.5 distance ALL THE TIME, from all 4 rayzer beams.

Well dummy me… I forgot to set the red BOXES for the rayzers… isPickable = false. The rayzers were measuring the distance to the bottom of their red boxes, because the rays are shooting-from red box centers.

So, now we see good distance numbers at console, as the ground plane tilts. I guess the next step would be to convert the distance values from the 4 rayzers… to a single angle in degrees.

If anyone would like to install that feature for us (for me), that would be fine.

The end objective… selective ramp-sliding from gravity-active freeCams.

If (currentAngle < 30 & !camera.isNaving) { camera.applyGravity = false }

Something like that. We want gravity to turn-ON again… IF user moves cam position.

It might be difficult to test whether the user moved the cam, or some momentary ramp-sliding moved it. It might take some careful tweaking to activate/control this “smart sliding” system.

It might be wiser… to shoot only ONE rayzer downward and get the pickedMesh. Then use ITS .rotation or .rotationQuaternion… to derive a degrees-of-rotation (a slope-angle). That would require 75% less rays, which means we could perf-afford a much faster distance-sampling rate.

Help/ideas welcome. Thanks!