Notifications
                
            
                Clear all
    
            
        [Closed] Align pivot to direction between objects
Mar 23, 2016 4:22 pm
                      So I have a fractured sphere which results in about 730 objects.
I want to have the pivot of each object point outwards from the center of the ‘sphere’
so basically, for each of the fragments, I need to align the pivot to the direction (vector?) between the center of the sphere (lets say a pointhelper is placed there) and the fragment.
                             2 Replies                        
                    Mar 23, 2016 4:22 pm
                      Replace “[target object name here]” with the name of your center point helper, then select all your fracture objects and run the following script:
  targetObj = $[target object name here]
  for obj in selection do
  (
  	dir = normalize (obj.pos - targetObj.pos)
  	forward = [0,0,1]
  	right = normalize (cross forward dir)
  	forward = normalize(cross right dir)
  	trans = matrix3 forward right dir obj.pos
  
  	obj.transform = trans
  	obj.objectoffsetrot = inverse trans.rotationpart
  )