display live protractor angle parameter value as textplus object without animated keys.

display live protractor angle parameter value as textplus object without animated keys.

tejam_prashant
Participant Participant
728 Views
2 Replies
Message 1 of 3

display live protractor angle parameter value as textplus object without animated keys.

tejam_prashant
Participant
Participant

the angle must read 0 degree to 360 degrees. the script that you gave worked well , but the angle does not increase after 180 degrees. 

tejam_prashant_0-1728128035114.png

 

0 Likes
Accepted solutions (1)
729 Views
2 Replies
Replies (2)
Message 2 of 3

leeminardi
Mentor
Mentor
Accepted solution

I hope @MartinBeh does not mind me jumping in here.  YOu have to keep the protractor from in effect flipping over.  Try the followinng:

 

-- location of three objects: Protractor, ObjectA and ObjectB
Ppos = $Protractor001.transform.pos
Apos = $ObjectA.transform.pos
Bpos = $ObjectB.transform.pos

-- unit-length vectors from H to A and B
vecHA = normalize (Apos - Ppos) 
vecHB = normalize (Bpos - Ppos) 
vecC = cross vecHA vecHB 
-- angle in degrees 
angDeg = acos (dot vecHA vecHB)

If (dot vecC [0,0,1]) >= 0 then angDeg 
else (360 - angDeg )

 

lee.minardi
Message 3 of 3

tejam_prashant
Participant
Participant

you are really amazing people Martin Beh , leeminardi..👌. Thanks you made my day.

0 Likes