Hi, I have been using ootii's rather fabulous motion controller with AC with generally good results. However, since AC is relinquishing animation control, I can no longer get my character to face the direction I want with the "Turn to" command. Neither body or face turning works any more.
I'm not entirely sure how to tackle this, is there something I need to set up in AC, do I need to create custom motions in MC or is the answer a bit of both?
Any help would be greatly appreciated.
Comments
You should generally be always able to read the intended character rotation with the Char script's GetTargetRotation function. If you're reading it and it's not returning the correct value, it may be a bug.
Re: the camera issue - are those cameras affected by the player? Are they parented to it, or have the player as their target? If not, the player prefab shouldn't be affecting their position.
Regarding the camera issue:
Let's move to a new topic with this one - please post the answers in a separate thread.
private void SetCharacterPosition()
{
if (_char.GetPath())
{
motionController.SetTargetPosition(_char.GetTargetPosition(), 1f);
}
else
{
ClearCharacterPosition();
if (_char.IsTurning () && _char.charState == CharState.Idle)
{
Quaternion newRotation = Quaternion.RotateTowards(motionController.transform.rotation, _char.GetTargetRotation(), 5f);
motionController.SetTargetRotation (newRotation);
}
}
}
The new lines basically check to see if the character is trying to turn on the spot, and so performs a gradual rotation towards the target. It's not the cleanest solution, but I can't see from the documentation how else to make a MC-controller character rotate withot assigning a destination.
I should re-iterate that this is a demonstration on the principles involved in creating an integration on the AC side of things - not an official "Motion Controller integration", and so it's up to the user to tailor the exact script to their own needs. However, if you find that this does at least fix the turning issue, I shall update the official tutorial with this amendment.