Project Zorb Lua Script Vessel

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
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

  • Zorb.zip
    7.1 KB · Views: 0
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
Give this a spin. It's hilarious. Turn on wind and use the scenario editor to drop yourself in various places.
 

Attachments

  • Zorb.zip
    7.1 KB · Views: 1

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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..
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,923
Reaction score
2,188
Points
203
Location
between the planets
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...
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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?
 

Gondos

Well-known member
Joined
Apr 18, 2022
Messages
261
Reaction score
309
Points
78
Location
On my chair
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...
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
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...
 

Gondos

Well-known member
Joined
Apr 18, 2022
Messages
261
Reaction score
309
Points
78
Location
On my chair
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.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,586
Reaction score
3,500
Points
138
Location
Massachusetts
Released to the masses. Enjoy!

 
Top