← MPP-Mainstore › Scripts MPP - Gravity Drift On Grab Download the documentation (.md)

Version 1.8.1 · updated September 24, 2026

MPP - Gravity Drift On Grab Script V1.8.1 - Documentation

Turns a prop into a helium balloon. The first time a visitor grabs the object, its gravity is ramped to a negative value: once released, it floats up gently, with a speed limit. A ceiling and XYZ bounds freeze it in the air (and can hide it) before it drifts out of the scene. On each release, its rotation smoothly realigns to the world axes.

This script is standalone - it does not require any other MPP script to function.

New in V1.8: a grab during the realign stops it at once, so the object never stays out of physics in a hand; a frozen object never comes back to physics; the gravity factor is written only while it changes (v1.7 wrote it 20 times per second forever), and the realign writes an orientation only when it changes; warnings in the script console for settings that would freeze the object on the first grab or keep it visible when frozen; settings grouped by category and a Debug Logging switch. V1.8.1 only changes the version number. Your settings are kept when you update: see "Updating from v1.7".


Quick Start

  1. After purchase, the script is in your Inventory in Build mode. Add it to a prop: a balloon, a ball, a lantern.
  2. The object must be a physics object (a RigidBody) of motion type Dynamic. Object/Ensure Can Grab (On by default) makes it grabbable at start.
  3. Build and visit. Grab the object and let it go: it drifts up at 2 meters per second at most, and freezes when it reaches the top of the default bounds (1023 meters).

That is all most balloons need. The rest of this guide details every option.


How It Works

MomentSettingsWhat happens
First grabGravity/...The gravity factor ramps from Start to Target; with a negative target, the object wants to go up
DriftingGravity/Max Up Speed, Ceiling/..., Bounds/...The upward speed is capped; the ceiling and the bounds are checked
ReleaseRelease/...The rotation smoothly realigns while the object keeps its position; then physics resumes
Ceiling or bounds reachedCeiling/Freeze On Ceiling, Bounds/Use XYZ BoundsThe object freezes in the air, is no longer grabbable, and can be hidden

Only the first grab starts the drift; the object then keeps its negative gravity for the rest of the scene session. A frozen object stays frozen until the scene restarts.

In the Build panel the settings are grouped by category: Gravity/, Ceiling/, Bounds/, Release/, Object/ and Debug/.


Gravity

The gravity factor is written only while it changes: during the ramp, then once at its end.


Ceiling

With Ceiling/Freeze On Ceiling On (default), the object freezes when it reaches a ceiling altitude:

With the default bounds, the bounds freeze the object first, at 1023 meters (see below).


Bounds

With Bounds/Use XYZ Bounds On (default), the object freezes when it leaves a world-aligned box:

A start position outside the bounds (margin included) gets a warning at start: the object would freeze at the first grab.

What a freeze does

The object stops (velocities set to zero), its gravity factor goes back to 1, it becomes not grabbable and static, and its scriptable meshes are hidden if the matching Hide setting is On. It stays that way until the scene restarts. Meshes that are not set Scriptable cannot be hidden: a warning says so at start when a Hide setting is On and no scriptable mesh was found.


Release

With Release/Realign Rotation On (default), each release starts a smooth realign of the object's rotation, while its position stays where it is:

During the realign the object is out of physics (Sansar's Keyframed mode): it neither falls nor rises. At the end, it gets its motion type back, its drift gravity factor is written again, and, for a Dynamic object, the velocity it had at release. If the object is grabbed again during the realign, the realign stops at once and the object behaves normally in the hand; a new release starts a new realign from the current orientation. A freeze during the realign is final: the object never comes back to physics.

With Realign Rotation Off, the object is released as is; its drift gravity factor is written once at each release.


Object

Object/Ensure Can Grab (On): makes the object grabbable at start, even if it was made non-grabbable in the editor. Off on a non-grabbable object: the effect never starts (a warning says so at start).


Editor Properties Reference (28 total)

Gravity

PropertyTypeDefaultDescription
Gravity/Start Gravity Factornumber, -2 to 21.08Gravity factor at the first grab
Gravity/Target Gravity Factornumber, -2 to 2-0.8Gravity factor after the ramp; negative = the object rises
Gravity/Ramp Secondsnumber, 0.001-600.02Blend from Start to Target; under 0.05 s = at once
Gravity/Kick Up Speednumber, 0-100.02One-time upward nudge (m/s) when the factor reaches 0 or less
Gravity/Max Up Speednumber, 0-302Cap on the upward speed (m/s); 0 = no cap
Gravity/Use Z As UpboolOffOn = up is (0,0,1); Off = the engine world up

Ceiling

PropertyTypeDefaultDescription
Ceiling/Freeze On CeilingboolOnFreeze the object at the ceiling altitude
Ceiling/Use Absolute AltitudeboolOnOn = Absolute Altitude; Off = start altitude + Height Above Start
Ceiling/Absolute Altitudenumber1024World altitude of the ceiling
Ceiling/Height Above Start (m)number, 0-100000Meters above the start altitude (relative mode); 0 freezes at the first grab
Ceiling/Hide On CeilingboolOnHide the scriptable meshes after a ceiling freeze

Bounds

PropertyTypeDefaultDescription
Bounds/Use XYZ BoundsboolOnFreeze the object when it leaves the box
Bounds/Absolute CoordinatesboolOnOn = world coordinates; Off = offsets from the start position
Bounds/Min X, Max X, Min Y, Max Y, Min Z, Max Znumber-1024 / 1024The six faces of the box
Bounds/Safety Margin (m)number, 0-101Inward margin on each face
Bounds/Hide On BoundsboolOnHide the scriptable meshes after a bounds freeze

Release

PropertyTypeDefaultDescription
Release/Realign RotationboolOnSmooth realign of the rotation on each release
Release/Rotate Secondsnumber, 0-208Duration of the rotation
Release/Hold Secondsnumber, 0-20.15Extra time out of physics after the rotation
Release/Align To World IdentityboolOnOn = target is the world axes; Off = keep the current rotation
Release/Ease In OutboolOnGentle start and end of the rotation

Object and Debug

PropertyTypeDefaultDescription
Object/Ensure Can GrabboolOnMake the object grabbable at start
Debug/Debug LoggingboolOffWrites the startup summary (Up vector, motion type, ceiling, bounds), the first grab, the end of the ramp, the realign start and end and the freeze reason to the script console

Version Notes

VersionWhat changed
v1.2 - v1.6First releases: gravity ramp on the first grab, kick and speed cap, ceiling, XYZ bounds with margin, hide on freeze, realign on release
v1.7Tidied version. Sold until V1.8.1
V1.8.0Realign that can be cancelled by a grab, a new release or a freeze; the object returns to its own motion type; gravity factor written only while it changes; orientation written only when it changes; guarded physics writes; warnings for a wrong setup; settings grouped by category; Debug Logging
V1.8.1 (this version)Version number only

Updating from v1.7

v1.7V1.8.1
Start Gravity Factor, Target Gravity Factor, Ramp Seconds, Kick Up Speed, Max Up Speed, Use Z As UpGravity/Start Gravity Factor, Target Gravity Factor, Ramp Seconds, Kick Up Speed, Max Up Speed, Use Z As Up
Freeze On Ceiling, Use Absolute Ceiling Alt, Absolute Ceiling Alt, Ceiling Above Start (m), Hide On CeilingCeiling/Freeze On Ceiling, Use Absolute Altitude, Absolute Altitude, Height Above Start (m), Hide On Ceiling
Use XYZ Bounds, Use Absolute XYZ Bounds, Min X ... Max Z (Bounds), Bounds Safety Margin (m), Hide On BoundsBounds/Use XYZ Bounds, Absolute Coordinates, Min X ... Max Z, Safety Margin (m), Hide On Bounds
Realign Rotation On Release, Realign Rotate Seconds, Realign Hold Seconds, Align To World Identity, Realign Ease InOutRelease/Realign Rotation, Rotate Seconds, Hold Seconds, Align To World Identity, Ease In Out
Ensure CanGrabObject/Ensure Can Grab

Recipes

A - Classic helium balloon. Gravity/Start Gravity Factor 1.1, Target Gravity Factor -0.8, Ramp Seconds 2.5, Kick Up Speed 0.8, Max Up Speed 2.5, Ceiling/Use Absolute Altitude On, Absolute Altitude 200 to 300: the balloon rises and vanishes in the sky.

B - Ultra-slow release. Start Gravity Factor 1.0, Target Gravity Factor -0.2, Ramp Seconds 4, Kick Up Speed 0.02, Max Up Speed 1: the object drifts away from the hand very slowly.

C - Ceiling relative to the start. Ceiling/Use Absolute Altitude Off, Height Above Start (m) 50: the object freezes 50 meters above where it started, wherever the copy is placed.

D - Stay in the room. Bounds/Absolute Coordinates Off, Min X/Min Y -5, Max X/Max Y 5, Min Z -1, Max Z 4, Hide On Bounds Off: the object freezes visibly when it leaves a 10-meter box around its start position.

E - No realign. Release/Realign Rotation Off: the object tumbles freely after release.


Troubleshooting

SymptomCheck
Nothing happens when I grab and release the objectThe object needs a Dynamic RigidBody ("No RigidBodyComponent found" or "RigidBody is not Dynamic" at start). Object/Ensure Can Grab Off on a non-grabbable object: the effect never starts
The object froze as soon as I grabbed itCeiling/Height Above Start (m) at 0 in relative mode, or a start position outside the bounds: the script console warns at start
The object froze at 1023 meters, not at my ceilingThe default bounds (1024 minus the 1-meter margin) are reached first. Raise Bounds/Max Z or turn Use XYZ Bounds Off
The object stays visible when frozenOnly scriptable meshes can be hidden: set the mesh Scriptable ("Hide is On but no scriptable MeshComponent was found" at start)
The object shoots upLower Gravity/Max Up Speed or raise Target Gravity Factor towards 0
The object does not rise enoughLower Target Gravity Factor (more negative) or raise Max Up Speed; check the Kick Up Speed if it rests on the ground
The object hangs in the air for 8 seconds after each releaseThat is the realign, out of physics: lower Release/Rotate Seconds or turn Realign Rotation Off
The object was frozen and I want it backA frozen object stays frozen until the scene restarts
I want to know what the script doesTurn Debug/Debug Logging On: the startup summary, the first grab, the end of the ramp, each realign and the freeze reason are written to the script console

Limits


ItemWhat it adds
Light Drain And Restore ScriptA rainbow and a dimming light on the same prop while it is held. Store: https://www.sansar.com/store/listings/95238b17-f553-4656-88b6-6bf10e4070b9/light-drain-and-restore-script
Random Object Spawner ScriptMakes new balloons appear when visitors click. Store: https://www.sansar.com/store/listings/1de81a6d-1e59-4b68-9423-c11b4deaa61d/random-object-spawner-script

MPP - My Pretty Pixels. Gravity Drift On Grab Script V1.8.1 (script MPP - Gravity Drift On Grab). Store: https://www.sansar.com/store/listings/d74417ad-2b75-41b2-9bd7-7a96cf12eef9/gravity-drift-on-grab-script

↑