x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is there any way to use "Rotation Follows Velocity" in Multiplayer Game?

Hi,

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. alt text

  • Then, with release, starts an event on server that spawns the arrow. alt text

  • In the Construction script of the arrow I get the arrow's owner(the archer), get the variable calculated before, and set the Initial Speed property of the arrow's Projectile component.alt text

The flight trajectory is perfect, but all clients, even the arrow's owner, see the arrow, with the sharp point down. It flies all the way "looking" on the ground, like it is shown on my picture.alt text 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!

P.S. 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.

Product Version: UE 4.14
Tags:
1.jpg (346.4 kB)
2.jpg (269.5 kB)
3.jpg (93.2 kB)
4.jpg (46.4 kB)
more ▼

asked Mar 02 '17 at 01:17 AM in Blueprint Scripting

avatar image

Zoran
11 1 2 3

avatar image ErtieZone Nov 28 '18 at 03:55 PM

Reply this if it isn't too late a year later!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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

more ▼

answered Dec 20 '17 at 08:09 AM

avatar image

SouthBot
46 1 5

avatar image Zoran Dec 23 '17 at 07:28 PM

Thanks for reply, but your variant is not right. There is a feature in of Projectile Component named "Rotation Follows Velocity". It rotates object dynamicaly.

avatar image SouthBot Dec 27 '17 at 03:01 PM

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.

avatar image SouthBot Dec 27 '17 at 03:15 PM

Just one other thing. For the collision it ignores all collision apart from the root component. So make something like a collsision sphere the root

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Theres a checkmark for "Rotation follows Velocity" in the projectile movement component, did you try that out?

more ▼

answered Aug 12 '17 at 04:24 PM

avatar image

Zerzuskan
0 1 3 7

avatar image Zoran Aug 12 '17 at 07:52 PM

Sure. This is the main feature i'm talking about.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Dec 20 '17 at 07:20 AM

avatar image

Hiengs2702
31 1 1 3

avatar image Zoran Dec 23 '17 at 07:44 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question