Physics basketball bounces infinitely in built server
I have a physics basketball that I am trying to add to a multiplayer game. The basketball works as expected when playing the game in the editor with Run Dedicated Server turned on. However, when I try to use the basketball in a built server as opposed to the dedicated server, the basketball bounces infinitely. This is not the outcome that I want, as not only does it look unrealistic but it also costs a lot of CPU.
The basketball inherits from a CProp class. The transform of each prop is replicated over the server. The Tick function interacts with the transform like so:
And here is the transform's OnRep function:
The basketball also has its own Blueprint functionality to handle physics (since it is the only object in the game so far that uses physics). Here is the function for picking up the ball:
Function for throwing the ball:
I have tried adding a Multicast RPC to the basketball which was executed every tick, but that didn't work either. The function looked like this:
I would deeply appreciate any advice that you all are able to give me, as this issue has plagued me for the better part of a week. Please let me know if anything I have mentioned in this question is unclear, and I look forward to hearing from you all soon! :)
asked Sep 25 '18 at 08:29 PM in C++ Programming
I actually solved my own problem! As it turns out, the issue wasn't replication over the network; all it took to solve the infinite bouncing was adjusting the Restitution value on the Physics Material that I was using from 0.95 down to 0.9. sad trumpets Either way, I'm very glad that I solved this, and I hope someone comes across this and finds it helpful!
answered Oct 01 '18 at 03:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here