Liberi
An exergame built for kids with CP!
GravityScalar.cs
1 using UnityEngine;
2 using System.Collections;
3 
7 [AddComponentMenu("Liberi/Gravity Scalar")]
8 [RequireComponent(typeof(Rigidbody))]
9 [Script(ScriptRole.Logic)]
10 public class GravityScalar : MonoBehaviour
11 {
15  public float GravityScale = 1f;
16 
17  void FixedUpdate ()
18  {
19  if (rigidbody.isKinematic)
20  return;
21 
22  rigidbody.AddForce(Physics.gravity * (GravityScale - 1), ForceMode.Acceleration);
23  }
24 }
float GravityScale
The scale by which to multiply by the scene gravity for this object.
Scales the effect of gravity on this object.