Created
October 18, 2017 06:52
-
-
Save igolden/0a4f3615fdcacdd4e70cbaae2a19d6a2 to your computer and use it in GitHub Desktop.
Control drag on a rigid body (unity script)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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