![]() |
|
#1
|
|||
|
|||
The problem might be caused by adding angpos[3] to the rotation. When you retrieve the axis angle it is not guaranteed that the rotation will be around the positive y axis. Try printing out the entire angpos for debugging. A better method might be to retrieve the euler rotation and use the yaw instead.
Also, you can use the vizmat.AngleToPoint function to compute the angle difference. Here is some sample code: Code:
pos=male1.get(viz.POSITION) euler=male1.get(viz.EULER) pos2=male.get(viz.POSITION) rotate_degrees = vizmat.AngleToPoint(pos[0],pos[2],pos2[0],pos2[2]) rotate_degrees -= euler[0] |
#2
|
|||
|
|||
Thanks a lot for your help. We did not know there existed an angleToPoint() method. This helped us solve this. The main problem was that we thought that the rotate() method used the current rotation, and rotated further on from that point. But it seems the method just places the avatar in the rotation, not regarding the rotation before the method is applied.
Now the function is working using the following code: pos=male.get(viz.POSITION) pos2=female.get(viz.POSITION) rotate_degrees = vizmat.AngleToPoint(pos[0],pos[2],pos2[0],pos2[2]) male.rotate(0,1,0,rotate_degrees) male.act(6) |
![]() |
|
|