vector compass

vector compass

magillaGuerilla
Collaborator Collaborator
596 Views
1 Reply
Message 1 of 2

vector compass

magillaGuerilla
Collaborator
Collaborator

Would anyone care to share some code or a link to explain how to create a vector compass?

I would like to plug the result into field directions - say to control the animated direction of gravity or wind.

 

It would be infinitely easier if the fields actually just took their orientation from the object.

0 Likes
Accepted solutions (1)
597 Views
1 Reply
Reply (1)
Message 2 of 2

magillaGuerilla
Collaborator
Collaborator
Accepted solution

constrain a couple of locators to the objects determining which way is up, then put this into an expression

 

float $pos1[] = `pointPosition -w "locator1"`;

float $pos2[] = `pointPosition -w "locator2"`;

 

float $gX = $pos1[0] - $pos2[0];

float $gY = $pos1[1] - $pos2[1];

float $gZ = $pos1[2] - $pos2[2];

 

nucleus.gravityDirectionX = $gX;

nucleus.gravityDirectionY = $gY;

nucleus.gravityDirectionZ = $gZ;

0 Likes