Hello,
i have a question: How can I stop character movement when a character is no longer relevant ?
Thanks!
Can you help me please?
Are you just looking for UMovementComponent::StopMovementImmediately()? or are you asking how to hook an event for when to call this function? And what do you mean by “relevant”, net relevancy?
Thanks bleeds187 for your answer! Yes, I mean net relevancy. I have a zombie character with a simple behavior tree that run only on dedicated server. The behavior tree look for a point in the map within a certain range by zombie and move the zombie in it. From client I see movement of zombie but, if the zombie is not relevant for me, I continue see zombie moveto() in the map… I want to stop it. StopMovementImmediately() can stop the movement of the zombie, but i don’t know when i can call this function… Can you help me? Thanks a lot.
anyone can help me please?
You can’t stop just the ‘movement’ being relevant but you can stop the entire relevancy of the actor using bTearOff - which will keep a copy of the actor on all clients but they’ll no longer receive network updates and they’ll simulate themselves. This is usually done for ragdolls on dead characters etc.
Alternatively, you can override PreReplication in the Character and tell the object which properties to replicate and when, but the actors is still considered for Replication.
Thanks TheJamsh for your answer! But i didn’t solve my problem, yet. Now I’ll try to explain it better to you here:
I have a Zombie Character replicated with one of his AI which makes him move in the map. The Zombie is relevant within a certain range defined in the variable “Net Call Distance Squared”.
The problem comes up when my character exceed this range, since the Zombie keeps moving! This is due to the fact that when i exceed this range, the server doesn’t send any more
information about the Zombie. I would like just the client to stop the Zombie in order to prevent him from making wrong movements.
Could you help me now please? Thanks
It sounds like you are trying to optimize your net cull distance too much; the default distance should suffice for almost everything, but the intent is that your game handles the client behavior of no-longer-relevant actors (and tear off the simulation as TheJamsh recommends). IIRC the server simply stops sending replication data to clients beyond the cull distance; at worst this is a bug that you should report on answerhub (as actors becoming irrelevant should not continue client side predicted movement). However, I would recommend just leaving your net cull distances to default; the amount of data sent is already optimized and unless your seeing performance issues with network data sent this should not be necessary, and even then there are likely offending bugs/issues you should resolve instead, like why are you sending so much to begin with.