Project Zorb Lua Script Vessel

Thunder Chicken

Resident Lua Script Rabble-Rouser
Donator
Joined
Mar 22, 2008
Messages
5,847
Reaction score
5,509
Points
188
Location
Massachusetts
So I was getting burned out trying to get Ackermann steering geometry into my VW Thing in a sensible way and wanted to do something quick and fun and maybe explore / abuse / stress-test the point-cloud contact model.

So I made a Zorb:

800px-Zorbing.jpg


Screenshot at 2024-06-27 20-21-56.png
It's just a transparent sphere (hand-crafted mesh again, of course). But all 290 vertices are also touchdown points, with stiffness and damping set to approximate a nicely bouncy ball. The weight, size, drag characteristics are all appropriate for a real Zorb.

And then I set up a scenario where I dropped it over the Alps with the wind turned on. Falling at terminal velocity of 20 m/s, no steering, just going wherever the wind and bounces take me...

Screenshot at 2024-06-27 20-14-34.png

Screenshot at 2024-06-27 20-12-38.png
This should be interesting...
 

Attachments

Last edited:
First contact, not quite as bouncy as I hoped:

Screenshot at 2024-06-27 20-34-19.png

But I seem to be rolling into a valley...

Screenshot at 2024-06-27 20-36-07.png
And the ride from inside is hilarious, I'm rolling...

Screenshot at 2024-06-27 20-35-49.png
Screenshot at 2024-06-27 20-35-44.png
 
It just rolls and rolls and rolls...

Screenshot at 2024-06-27 20-45-58.png
I made one half of the mesh slightly darker so you can get a sense of the rolling behavior. It's rolling like a billiard ball:

Screenshot at 2024-06-27 20-53-40.png
 
Actually, there is a problem with Scenario Editor "Landing" the zorb. If you locate to some place on the surface, even if it is steeply sloped, the zorb just sits there. I needs to be in flying/orbiting status, but then positioning on Earth gets difficult.
 
Does anyone know if there is a way to get the local calculated displacements of the vertices in this model? They must exist in some form within Orbiter. If they could be determined and used to adjust the mesh you could get some interesting compliant meshes for tires, zorbs, etc..
 
Some experiments:

I disabled drag by commenting out this line in Config/Vessels/Zorb/Zorb.lua:

Code:
--vi:set_cw({x=1, y=1, z=1, zn=1})

This causes the impact speed to increase, and hence it bounces higher.

I was trying to see if I could make something that bounces like Flubber. So in Config/Vessels/Zorb/set_contact.lua I set the damping_value to 0, and increased the stiffness by three orders of magnitude. With no damping energy should be mostly conserved. This made it a little bit more bouncy, but I suspect that quite a lot of energy is getting numerically dissipated due to the short period of impact and the numerical integrators can't really resolve that. Adding more stiffness quickly bounces me out of the solar system.
 
Does anyone know if there is a way to get the local calculated displacements of the vertices in this model?
No, the touchdown point compression is not exposed by the API currently. I had posted this feature request a long time ago because I wanted to make a compressible landing gear without doing all the math myself, way back when before orbiter went open-source. Maybe somebody's going to do it, now that we technically could...
 
No, the touchdown point compression is not exposed by the API currently. I had posted this feature request a long time ago because I wanted to make a compressible landing gear without doing all the math myself, way back when before orbiter went open-source. Maybe somebody's going to do it, now that we technically could...
Did you submit it as an issue in GitHub?
 
The relevant code seems to be this in Vessel.cpp:
Code:
    ElevationManager* emgr = (cbody->Type() == OBJTP_PLANET ? ((Planet*)cbody)->ElevMgr() : 0);
    int reslvl = 1;
    if (emgr) reslvl = (int)(32.0-log(max(alt,100.0))*LOG2);

    Vector shift = tmul(ps.R, s->pos - ps.pos);
    for (i = 0; i < ntouchdown_vtx; i++) {
        Vector p (mul (T, touchdown_vtx[i].pos) + shift);
        double lng, lat, rad, elev = 0.0;
        proxybody->LocalToEquatorial (p, lng, lat, rad);
        if (emgr)
            elev = emgr->Elevation (lat, lng, reslvl, &etile);
        tdy[i] = rad - elev - proxybody->Size();
        if (!i || tdy[i] < tdymin) {
            tdymin = tdy[i];
        }
    }
tdy then contains the penetration distance (if negative) for each touchdown point.
I doubt the elevation manager is available in Lua though...
 
The relevant code seems to be this in Vessel.cpp:
Code:
    ElevationManager* emgr = (cbody->Type() == OBJTP_PLANET ? ((Planet*)cbody)->ElevMgr() : 0);
    int reslvl = 1;
    if (emgr) reslvl = (int)(32.0-log(max(alt,100.0))*LOG2);

    Vector shift = tmul(ps.R, s->pos - ps.pos);
    for (i = 0; i < ntouchdown_vtx; i++) {
        Vector p (mul (T, touchdown_vtx[i].pos) + shift);
        double lng, lat, rad, elev = 0.0;
        proxybody->LocalToEquatorial (p, lng, lat, rad);
        if (emgr)
            elev = emgr->Elevation (lat, lng, reslvl, &etile);
        tdy[i] = rad - elev - proxybody->Size();
        if (!i || tdy[i] < tdymin) {
            tdymin = tdy[i];
        }
    }
tdy then contains the penetration distance (if negative) for each touchdown point.
I doubt the elevation manager is available in Lua though...

This is from the ground perspective? If the penetration distance is measured in the y-direction relative to the horizon, then just passing that distance is all that is needed, as the vessel can access that coordinate system. If the penetration distance is relative to some ground mesh in the direction of the local normal (as I suspect it must be), then that normal would be needed too.
 
My brain wondered if I could "motorize" the Zorb by changing the stiffness and damping of the contact points in a sequence.

Why brain, why...
 
This is from the ground perspective? If the penetration distance is measured in the y-direction relative to the horizon, then just passing that distance is all that is needed, as the vessel can access that coordinate system. If the penetration distance is relative to some ground mesh in the direction of the local normal (as I suspect it must be), then that normal would be needed too.
This is from the local horizon perspective.
 
Released to the masses. Enjoy!

 
This is from the local horizon perspective.
If the hull penetration distance is measured relative to horizontal, this is very interesting as that could potentially permit modeling of water-borne floating vessels in conjunction with the contact model. I am tinkering with some simple flotation tests to see if this is possible now. If it is, having access to this penetration distance might permit generally shaped hull modeling. Hmm...
 
@Gondos I made a buoyancy model with the touchdown points model that seems to work:


If we were able to access the depth of the submerged vertices in the horizon-relative vertical frame from Orbiter, that would permit calculation of the local hydrostatic pressure which could permit realistic simulation of floating vessels with arbitrary hull shapes.
 
I pushed a prototype branch if someone wants to play with it. I did not have time to really test this yet, I'll join binaries if anyone's interested.
From Lua: vi:get_groundcontactpenetration(idx), with idx the touchdown point number. It returns a number (double), negative if the point is under the surface.
This will be slow if you have a large number of points to check.
I presume it should be accessed in the clbk_poststep so the physics has been run.
 
Last edited:
Back
Top