Skip to content

Instantly share code, notes, and snippets.

@julik
Created June 8, 2010 09:39
Show Gist options
  • Save julik/429821 to your computer and use it in GitHub Desktop.
Save julik/429821 to your computer and use it in GitHub Desktop.
GetGlobalPos(obj) // Get the global transform matrix for an object independently of the parenting
{
var globalMatrix = obj->GetMg();
return globalMatrix->GetV0();
}
main(doc,op)
{
var radius = 50;
var p = GetGlobalPos(op);
var r = op->GetRotation();
r.z = p.x / radius;
op->SetRotation(r);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment