#How to make an actor turn to the angle as it moves

1 messages · Page 1 of 1 (latest)

tropic topaz
#

Trying to code a sheep right now that will move and turn randomly,and can turn to change its direction mid movement.However im unable to set the motion direction equal to the sheeps angle,any ideas on how to find a way around this (or fix)?

quick verge
#

Let me see if I understand you want the sheep to move in the direction of the angle?

tropic topaz
lofty tinsel
#

cos/sin angle calculates the distance that will need to go inside a circular area, to calculate the area of that circle that number gets multiplied by any number you want it to be the area (in this case its three)

example: lest suppose the angle is 180, and for it to have a speed of 3 blocks per second
cos(180) × 3 = -3
sin(180) × 3 = 0
since the number in cos is negative, the object goes 3 blocks backwards, and since the number in sin is zero, it wont move neither up or down