Skip to content

Instantly share code, notes, and snippets.

@natecraddock
Last active August 4, 2016 21:06
Show Gist options
  • Select an option

  • Save natecraddock/68a7b88fc329bf92027662e5f5102339 to your computer and use it in GitHub Desktop.

Select an option

Save natecraddock/68a7b88fc329bf92027662e5f5102339 to your computer and use it in GitHub Desktop.
Returns the distance between two objects in Blender
import math
def pythagorean(object1, object2):
dx = object1.location.x - object2.location.x
dy = object1.location.y - object2.location.y
dz = object1.location.z - object2.location.z
return math.sqrt(pow(dx, 2) + pow(dy, 2) + pow(dz, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment