Exact Location

hello. I want move my character to specific location for play a animation, that must be precise but i can’t get the same position. I try simple move, teleport, nothing take my character to the same vector, there is a very small error and sometimes a more big one.

any idea, recomendation how achieve accuracy.

Set location

same problem, not always the same positions.

but i think why and how fix, i play the animation after a key press and never work fine if my character are in movement, i disable input from user before set new location, and its same.
But if i stop the character and then press the key seems work, and after that i added a 0.2 delay between “disable input” and “set location” and seems work if user press key while the character walk.

Going to do few trys before assumed fixed.

what’s the error range look like? can you give a number. Sometimes it is possible to get fairly big error if the vector is far enough away from origin.

yep i write few values while investigate. the error is low, but for what i need need very low. The origin ins’t far.

575 / 746.548 / 213
574.287 / 671.045 /214.150
574.104 / 671.588 / 215.150

i think the cause its the pawn movement, with that delay seems fixed.
except if i jump or while falling and press the key for teleport/set location/e.tc. the error its more big (anyway nothing drastic) . i think i must disable that possibility in my proyect. :confused:

anyone known if its bug or normal issue? must report bug?

My “guess”(seems that most of my reply is based on guess) is since UE4 is running in multi-thread, and you have say 2 things trying to control the position variable.
One being the movement that gets input and moves character around, one being your teleport(functions you use doesn’t matter.)

With programming view of this we call race condition, say one thread is increase a variable, another thread decrease the same variable, while the other thread doing something depending the value.
(imagine a queue process system where you get new job in queue, you remove job if job is done/dispatched, and a thread to show how many job in a queue. )
What we used to prevent this situation is called, mutex, which lock/unlock a variable from writing attempt. Or in the future atomic variable, which does same thing from the compiler side.
So you essentially create a less then ideal “lock” by using the delay.

Back to UE4, what you can do is see from the engine side, what is causing stuff to actually move from movement component’s perspective?
The answer is, if any state involving move, ie, velocity, angular velocity, force, torque, are not zero, there would be movement.(let’s disregard gravity since it’s consider a constant force and physics are the one preventing you fall through floor.)
My approach would be when I need to teleport, I would do the following:

  1. disable input
  2. zero out all state that could affect movement
  3. teleport
  4. enable input

And I would implement this in a function to ensure that it was all done in one call. (hopefully the function you use to teleport is not consider a latent function.)
Try this and see if your accuracy is improved, if you would want to then still preserve momentum, you need to save those state variable and apply them “after” you teleport sequence is done.

for now I’ll do something like that

another problem i have on this topic its using “Simple Move”, teleport or set location, got same problem with all

i want a character go to a specific postion, i create a socket in a mesh for offset the position from object and get the socket location (i don’t known if this is the best way)

anyway depend of position of that character (left/right from socket) the location ins’t the same.

I made a new proyect and a video with the basic problem

i supposed the character going to that position (center character / socket location ) but seems they never reaches the center, seems “when touch the location stop”, i can deal with this moving the socket but if depend where comes the character that its a big problem

“Simple Moving” or other methods none work like i want.

anyone known how to solve that? or what can i do? ideas are welcome.

SimpleMoveTo uses NavMesh may not produce “exact” result, as the point of “goal” maybe unreachable, like some where floating in air.
It could be pretty difficult if your block with socket can be arbitrary anything, so usually closest point is used.
But teleport should be exact, but for the root component’s transform, so it may not be seem to be exact.

I created a volume spawn and tested teleport my spawned object, it’s on spot all the time.(I disabled simulation so all items will just float in air, and I check if they collide with any edges of the volume.)
So if teleport not working, it must be either pawn moved after teleport, or the input transform is not exact.

yep i try again and work, i think i forget connect “target” when i try.

I going to do “Simple Move” and when reach the goal a teleport for be more exact,

Anyway i don’t like the effect of “teleport” for a character, would be nice if someone had good way for move the character like “Simple Move” but more exact please

it would be a pretty interesting project, if it’s me doing it, I would probably do it from controller side.

The problem you probably gonna have with SimpleMove+teleport is the animation close to the end won’t “ease out” as in slowly come to stop at goal position.
SimpleMove to use controller to achieve this and let the movement to handle the starting/stopping, so when SimpleMove “think” we are getting there and stop giving input,
it’s going to slow down and teleport might make it look like a sudden jitter at the end.

I don’t know why it has to be exact, but if you can pull it off with simple and elegant solution, it could be worth a conference talk. :smiley:
(Since all the game AI are more or less have this type of issue, if the boundry/goal location can be exact plus using existing/efficient path finding, that would be something.)

I newbie in this world for a “elegant fix” but I think someone with more knowledge can do something.

the problem its “Simple move” not going to the root component or center character, i realize the character SEEMS stop when the capsule reach the point, seems work like “On Overlap” for detect the goal.

knowing this… i change the width size of the capsule to 0.01 before reach the goal and restore after. lost the collision on the mesh for a seconds but its ok for what i want, the exact location or very near.

0.01 width? that must be near exact! i goto it! i am genius of dirty tricks! lol … but not, something not work like expected, that small capsule neither reach the goal.

Anyway that minimize the teleport/set location “jump” now its more precise, but still need the teleport and the jump still evident.

i have another idea and that must work.

The distance stop->goal its always the same, the location its EXACT always if the character reach the goal from the same direction, for this i think that must be easy fix for devs to “simple move”,

I think i can fix that adding that distance to the expected goal taken in consideration the direction/vector of the character when they going to reach the goal.
not known if i explain well … my english its bad. This must be the solution but i think i not going to try that yet, i have lots of thinks to do and learn.

i perhaps submit that to the Answer Hub before, perhaps there are someone in AH can answerd with a easy way or if there are something i miss.

Sure thing, do the AnswerHub, they have more staff watching there than in the forum.

Another thing I would contribute is that when you are close to the end of your goal, you can probably use setlocation+lerp, so that the “jump” can be ease out per update.
OR, invest time in C++ side of thing, and change the SimpleMove yourself. :smiley:

yep with lerp no jump, glide, its better