Advertisement
LittleAngel

Black Hole

Sep 24th, 2013
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. if (blackHole.active) {
  2. Vector3 gravityVector = blackHole.transform.position - thisTransform.position;
  3. float gravityDistance = Vector3.Distance(blackHole.transform.position, thisTransform.position);
  4. Vector3 gravityStrength = Vector3.zero; // if (gravityDistance < gravityRadius) HERE??
  5. gravityStrength.x = gravityConstant / Mathf.Pow(gravityDistance, 2);
  6. gravityStrength.z = gravityConstant / Mathf.Pow(gravityDistance, 2);
  7. if (gravityDistance < gravityRadius)
  8. currentVelocity = currentVelocity + (Vector3.Scale(gravityStrength, gravityVector));
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement