Hi there,
I encountered problems with that, so basically I've a queue of vector4 with the fourth dimension used for the time, and I want my character to follow the path. But I want to do it with a character collider in order to ensure that the character is on the floor, so by the use of SimpleMove. dataSet is an interface for my queue The problem is that my character go too far.
Could you help me please ?
void Update()
{
if (dataSet.Size() > 1 && Time.time >= endPoint.w)
{
transform.position = endPoint; // Ensure that the previous move was well done (for instance if the character is stuck onto a wall, etc.)
endPoint = dataSet.GetAndErasePeekVector4() + (Vector4)offset; // The new endpoint
transform.LookAt(endPoint);
speed = Vector3.Distance(transform.position, endPoint) / (endPoint.w - Time.time);
direction = (Vector3)endPoint - transform.position;
}
characterController.SimpleMove(direction*speed);
}