
Gravity Drift On Grab Script
You need to own this item to leave a rating.
Thanks to Nicci for her excellent suggestions and help.
------------------------------
### WHAT IT DOES (PURPOSE)
Makes a prop gently float upward when first grabbed by ramping gravity to a negative value.
When released, it keeps its position and upward motion but smoothly realigns its rotation to world axes.
Optional:
• Ceiling and XYZ bounds to protect against respawn
• Freeze and hide if the object travels too far
------------------------------
### HOW IT WORKS (BASICS)
**ON FIRST GRAB**
* Gravity Factor blends from Start to Target over Ramp Seconds
* If Target is negative → the object drifts upward
* Optional: Kick Up Speed adds a small push along Up axis when gravity flips
**WHILE DRIFTING**
* Vertical speed clamped with Max Up Speed
* Safety checks verify ceiling and XYZ bounds
**ON RELEASE**
* Object stays in position and keeps velocity
* It SLERPs rotation to world alignment over Realign Rotate Seconds (with optional Ease In/Out)
* After a short Hold, physics returns to Dynamic
------------------------------
### MOST IMPORTANT PARAMETERS
• TARGET GRAVITY FACTOR
→ Negative to float upward (e.g., -0.8)
• RAMP SECONDS
→ Speed of gravity transition from Start to Target
• MAX UP SPEED
→ Caps vertical speed to prevent runaway motion
• XYZ BOUNDS + MIN/MAX X/Y/Z + SAFETY MARGIN
→ Hard position limits with a buffer to avoid respawn
• REALIGN ROTATION ON RELEASE + ROTATE SECONDS + EASE INOUT
→ Controls upright realignment smoothness
------------------------------
### OPTIONS OVERVIEW
• USE Z AS UP – For Z-up scene setups
• FREEZE ON CEILING / ABSOLUTE CEILING ALT / CEILING ABOVE START – One or both ways to define vertical limits
• HIDE ON CEILING / HIDE ON BOUNDS – Makes object invisible once out-of-bounds
• ENSURE CANGRAB – Guarantees the rigidbody remains grabbable at runtime
• ALIGN TO WORLD IDENTITY – Targets perfect world-aligned rotation
• REALIGN HOLD SECONDS – Micro-stabilization after SLERP
------------------------------
Enjoy and Keep Good Vibes.
Hugs from Morgane.
------------------------------