Skip to content

Instantly share code, notes, and snippets.

@maxweisel
Last active April 29, 2016 22:03
Show Gist options
  • Save maxweisel/eae8d3c72394090be8d5f0b8e607c6d7 to your computer and use it in GitHub Desktop.
Save maxweisel/eae8d3c72394090be8d5f0b8e607c6d7 to your computer and use it in GitHub Desktop.
void TriggerEnded()
{
// Throw the cube by setting the velocity on its rigid body using the rigid body on the empty game object.
Rigidbody rigidBody = _cube.GetComponent<Rigidbody>();
rigidBody.velocity = _controllerRigidBody.GetPointVelocity(_controller.transform.TransformPoint(offset));
rigidBody.angularVelocity = _controllerRigidBody.angularVelocity;
rigidBody.isKinematic = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment