Skip to content

Instantly share code, notes, and snippets.

@eddietree
Created June 6, 2016 18:30
Show Gist options
  • Save eddietree/9e9f72fa8ba55b69199a9ed8c86410e6 to your computer and use it in GitHub Desktop.
Save eddietree/9e9f72fa8ba55b69199a9ed8c86410e6 to your computer and use it in GitHub Desktop.
public override Vector3 GetThrowVelocity()
{
var device = GetDevice();
// basically to calc throw velocity:
// 1) set phantom volume to controller pos
// 2) set its velocity calc the velocity point of throwing
var rb = throwVolume;
rb.transform.position = transform.position;
rb.velocity = device.velocity;
var throwVelocity = rb.GetPointVelocity(obj.transform.position) * throwVelocityBoost;
rb.velocity = Vector3.zero;
return throwVelocity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment