Hi all.
My project is to create a mini-game in which a player embodies a custom character (team 1) and 4 other players (team 2) aim to run away from him and survive.
I hided the player and I used the famous MoveTo().
However, I need it to be reactive to player input, so the prop needs to follow the player in a very short delay, below 100ms, to have the illusion that the player can control it, and not that the prop simply follows it.
My problem is that the MoveTo() function apparently doesn’t like when I go below 0.5, it jerks violently.
My code is pretty simple :
UpdatePropPos(FortCharacter : fort_character)<suspends>:void=
Sleep(0.0)
Result : move_to_result = MyProp.MoveTo(FortCharacter.GetTransform().Translation, FortCharacter.GetTransform().Rotation, 0.1)
if (Result = move_to_result.DestinationReached):
UpdatePropPos(FortCharacter)
I also tried this custom function found on another topic in this forum but it produce the same result : jerks, jerks, jerks…
# Custom MoveTo function
(Prop : creative_prop).MoveToPositionalExpected(Target : positional, Offset : vector3)<suspends>:void =
TargetRotation := Target.GetTransform().Rotation # [Could specify a target rotation or make relative to Target]
loop:
TargetTransform := Target.GetTransform()
TargetPos := TargetTransform.Translation
Arrived := race:
block:
MovePos := TargetPos + TargetTransform.Rotation.RotateVector(Offset)
# The farther apart the longer the time to get there [could pass in adjustment]
TimeToMove := Distance(TargetPos, Prop.GetTransform().Translation) * 0.001
Prop.MoveTo(MovePos, TargetRotation, TimeToMove)
true # Arrived
block:
# Update move to location occasionally [could pass in value]
Sleep(0.5)
false # Not arrived
if (Arrived?):
break
Would a charitable soul have a miracle technique or a workaround ? Or is it simply impossible ?
I’ve read a lot of threads on this forum without finding a solution.
Thanks.