Translate direction and speed to values for moveright and moveforward

Hi All,

I have a animation blueprint I’d like to share between the player character and AI driven bots. The animation blueprint currently is driven off of values obtained from MoveRight and MoveForward axis values. However for AI driven bots, these are obviously not getting triggered since there is no keyboard/gamepad controls controlling AI bots. Question, is there a way to translate “direction” and “speed” in the event graph into values for moveright and moveforward?

InputComponent->BindAxis("MoveForward", this, &ACharacter::MoveForward);
InputComponent->BindAxis("MoveRight", this, &ACharacter::MoveRight);
InputComponent->BindAxis("Turn", this, &ACharacter::AddControllerYawInput);
InputComponent->BindAxis("LookUp", this, &ACharacter::AddControllerPitchInput);

in the event graph for anim blueprint, I can get access to
TryGetPawnOwner->CalculateDirection and TryGetPawnOwner->GetVelocity->VectorLength->Speed

Is there a way to get the direction and speed and translate it to values for “moveforward” and “moveright”?

Thanks

sounds like you need to convert from Polar to Cartesian coordinates, with a bit of trigonometry.

MoveForward = Speed * cos( Direction )
  MoveRight = Speed * sin( Direction )