Support Forum

Change the rotation of a bot

Hello,
I’d like to fix a bot positioning issue,
here is the code i’m using but unfortunately it doesn’t seem to solve the problem.

void ChangeRotation(IADestination _ia)
{
_ia.ai.canMove = false;
Vector3 nextPosition;
Quaternion nextRotation = Quaternion.Euler(0, -147.499f, 0);

    _ia.aiPath.rotationSpeed = 0;
    _ia.aiPath.slowWhenNotFacingTarget = false;

    _ia.gameObject.transform.rotation = Quaternion.Euler(0, -147.499f, 0);

    _ia.ai.MovementUpdate(Time.deltaTime, out nextPosition, out nextRotation);
    _ia.ai.FinalizeMovement(nextPosition, nextRotation);

    _ia.aiPath.rotationSpeed = 450;
    _ia.aiPath.slowWhenNotFacingTarget = true;

}

I use IAstarAI for traveling.

Thank you for your help.

Still not found the solution to my problem unfortunately.
If someone could help me it would be nice.
Thank you.

Hi

Can you describe the problem you are having?

Hi,

The problem I meet is on the giff.

Short description: When my BOT is TP it keeps its rotation in memory, when I give it the possibility to move it wants to return to its rotation from the beginning of the TP while I implant a rotation.

I don’t know if I expressed myself well but the gif speaks for itself.

Hi

The AI will use the rotation from the transform. Are you sure you are setting it correctly?

Hi,
Unfortunately he keeps his way, is there any way to remove it from him.

I use IAstarAI with this method I have not found a way to remove its path.

If I delete its path it will certainly solve the problem, I would like to try.

Here is the code that assigns it route

IAstarAI ai;
ai.destination = pos;

Thank you for your help.