Teleporting agent

matmalm

Member
Is there a task to teleport an agent to x position and rotation?

My agent is a ghost, so I don't really need to animate the movement from one place to their destination.
I tried with transform -> Set Position, but it didn't teleport to the destination. It kind of does like a flickering movement of 0.1 sec and stays in the same position. I also tried it with shared transform game object, but still nothing. Even created my custom task, but couldn't achieve it.
I'm using Opsive Legacy character controller with my agent.
 
Last edited:
In this situation I would create a new ability that sets the DesiredRotation/DesiredMovement values and have it always active. You don't want to directly set the position every frame since that resets the internal movement variables and would cause jittery movement.
 
In this situation I would create a new ability that sets the DesiredRotation/DesiredMovement values and have it always active. You don't want to directly set the position every frame since that resets the internal movement variables and would cause jittery movement.
Thanks! That did it :)
 
In this situation I would create a new ability that sets the DesiredRotation/DesiredMovement values and have it always active. You don't want to directly set the position every frame since that resets the internal movement variables and would cause jittery movement.
When setting the transform in my new ability it ignores the Ability Index Parameter which holds the animation. I already deleted the logic of the code and it does the animation, but when I insert the logic it ignores it.
Should I implement a new ability for the animation or could be something wrong with the code?

namespace Opsive.UltimateCharacterController.Character.Abilities
{
using UnityEngine;

/// <summary>
/// Positions the character on a chair.
/// </summary>
public class PositionOnChair : Ability
{
[Tooltip("The transform representing the chair.")]
[SerializeField] protected Transform m_ChairTransform;
[Tooltip("The offset to apply when positioning the character on the chair.")]
[SerializeField] protected Vector3 m_PositionOffset;

/// <summary>
/// The ability has started.
/// </summary>
protected override void AbilityStarted()
{
base.AbilityStarted();
m_CharacterLocomotion.SetPositionAndRotation(m_ChairTransform.position + m_PositionOffset, m_ChairTransform.rotation);
}
}
}
 
I am not able to support version 2 anymore and that looks like a call specific to version 2. For continued support please update to version 3 and I'll have a better idea of what is going on. It has been awhile since I looked at the version 2 codebase.
 
I am not able to support version 2 anymore and that looks like a call specific to version 2. For continued support please update to version 3 and I'll have a better idea of what is going on. It has been awhile since I looked at the version 2 codebase.
Okay, pretty sure is totally worth the version 3, but right now I can't afford it.
I'll keep looking.
 
Top