Here is my task. An archer-player holds the Fire button for some time to increase the shot power. Archer and bow play for some shot animations. On button release the arrow flies with initial speed based on power calculated. All the clients should see the arrow flight and the shooter animations. Dedicated server.
I’d like to use the property of Projectile Component for natural flight.
With the fire button press I start an event on server that plays the anim and counts the initial speed for future arrow.
Besides the fact that I’m not an artist, it’s obviosly seen that on client side “Archer’s” variable InitBulletSpeed is 0. Debug shows that the problem is that all the clients, even the arrow’s owner “do not know” who is the owner. So, when the arrow’s Const Script runs on a client, function GetOwner returns None.
It should be said that of cause both the archer class and the arrow class have properties “Replicates” and “Replicate Movement” checked. Projectile movement component of arrow also replicates. Relevancy props are in default states.
So, I can’t understand why the owner is not known by clients, I can’t transmit any data to Const Script(for example, the archer-shooter, or speed var from him), and I can’t set the arrow’s init speed anywhere except the Const Script.
I would be thankful for any ideas!
I’m not sure, but may be it’s important - archer class is not the default player’s pawn, it is created during the game.
You state that the flight path is fine but it just faces the wrong way…
I assume that your arrow has a Blueprint? Go into the Arrows Blueprint and in Viewport try rotating the arrow in the Transform setup
Velocity is not replicated from sv to client, so i think u cant use Replicated Actor to perform this Rotate follow velocity. Instead of that, u can use the Combine func Run on Server + Multicast to spawn the Arrow on All Server and clients, and make sure the arrow does not replicated. And when the Arrow collide with something, u can check if that arrow is on server → do your logic here. That is my solution for this.
Hiengs2702, I think you may be quite right. I had no time for my project, but as I remember, my solution was to treat the arrow like an FX-effect, when there is no arrow on server but every client creates it’s copy of arrow. As I remember, quick test showed that there was no problems with applying damage. I mean damage multiplication. But I’ll try you solution when I would have time. Thank you!
I know that it rotates dynamicaly. But it also assumes that your projectile is facing the way you want it to go before you start.
I am using this to launch a missile. It works on both server and client.
When I started the missile also went like your diagram. I rotated it as I mentioned in my earlier post and it works fine.