#1
|
|||
|
|||
Problem with letting an avatar face towards another avatar
I am trying to let an avatar face towards another avatar, but i can't get it working.
I am trying to calculate the number of degrees that have to be rotated, using the difference between the x and z coordinates of the two avatars, but it gives wrong values, and i cannot find out why. Can anyone help? if(ag1=='a3' and ag2=='a1'): pos=male1.get(viz.POSITION) angpos=male1.get(viz.AXISANGLE) pos2=male.get(viz.POSITION) print "position",pos2 xdif = pos2[0] - pos[0] zdif = pos2[2] - pos[2] rotate_radians=math.atan(xdif/(zdif+0.0000001)) rotate_degrees = math.degrees(rotate_radians) rotate_degrees -= angpos[3] male1.rotate(0,1,0,rotate_degrees) male1.act(6) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|