# ProjectZorb Lua Script Vessel

#### Thunder Chicken

Donator
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.

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...

This should be interesting...

#### Attachments

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

#### Thunder Chicken

Donator
First contact, not quite as bouncy as I hoped:

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

And the ride from inside is hilarious, I'm rolling...

#### Thunder Chicken

Donator
It just rolls and rolls and rolls...

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:

#### Thunder Chicken

Donator
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

Donator
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

Donator
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

Donator
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
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

Donator
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
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;
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

Donator
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;
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

Donator
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...

#### jedidia

##### shoemaker without legs
Did you submit it as an issue in GitHub?
Orbiter wasn't yet on github back then, it would be burried somewhere in the feature requests in the forum...

#### Gondos

##### Well-known member
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

Donator
Released to the masses. Enjoy!

#### Gondos

##### Well-known member
Looks like the Zorb.cfg file is missing

#### Thunder Chicken

Donator
Looks like the Zorb.cfg file is missing

#### Thunder Chicken

Donator
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...

#### Thunder Chicken

Donator
@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.

#### Gondos

##### Well-known member
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: