Skip to content

Instantly share code, notes, and snippets.

@igolden
Created October 18, 2017 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igolden/0a4f3615fdcacdd4e70cbaae2a19d6a2 to your computer and use it in GitHub Desktop.
Save igolden/0a4f3615fdcacdd4e70cbaae2a19d6a2 to your computer and use it in GitHub Desktop.
Control drag on a rigid body (unity script)
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public Rigidbody rb;
void Start() {
rb = GetComponent<Rigidbody>();
}
void OpenParachute() {
rb.drag = 20;
}
void Update() {
if (Input.GetButton("Space"))
OpenParachute();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment