Second Player Physics Handle Problem

Hi everyone,

I currently have a second player added to my game which can be controlled independently, the only problem is the physics handle for the ship class. What happens is that the first player can grab objects in the way that was intended, however the second player will always grab the first player regardless of where they are on the map!

Grab Object

Drop Object

Update Physics Handle

Gamepad Trigger

I know it is something to do with the fact that my Grab Object and Drop Object functions are currently set with the Player Controller/Pawn/Camera Manager to Player 0, however I cannot for the life of me figure out how I could go about changing it because of the need to have these references to the Controllers, Pawns and Cam Managers. Can anyone suggest a way around this?

Thanks in advance!

Hi,

I cant answer you question im afraid, I was looking for an answer myself but I am interested by the sound of your game, I heard you mention ships and the ability to grab other ships and asteroids, sounds cool. I hope you fix your issue with the grabbing.

I am trying to make a online multilayer game where you play as a dragon. The dragon is a pawn class so I can use my custom collision instead of a capsule and use physics but networking doesn’t seem to sync physics objects… Do you know anything about the networking in UE4?

Thanks

Hi,

Yeah I’m hoping it’s just one of those things which looks complicated at first but turns out to be rather simple. For the time being my game is going to be just local multiplayer and the physics themselves aren’t a problem for me because Unreal is doing most the leg work thankfully.

In terms of the issue you have with networking I wouldn’t know anything about that. You are probably best asking it as it’s own question really and opening it up to the answers hub.

All the best with your game and thanks for the comment

I found some other forums which mentioned different ways to do it, one being to make the character kinematic on client computers and send the input to the server which would then apply the forces. this would work but would probably feel really unresponsive if you had much lag so I am planning on doing local multiplayer or single player too and see if epic adds a easy way of doing it. If not I might give it a go when I get a bit more experienced.

Small development, I have managed to get both players to grab and carry objects now however when releasing and fire the object it now travels in a random direction, I think the direction of where the camera is facing or perhaps even towards coordinates 0,0,0. Looking at the Drop Object function that I have above, is there anyway to make it non specific to Player 0 so that it takes it off each players pawn?

I made a Player Camera Manager blueprint and tried to reference it hence the object travelling in a random direction. Is the reason it doesn’t work because the camera isn’t placed on the game start?

Hi StomachBug,

This is what I use in my testbed and it works correctly with 2 clients.

What blueprint did you create this setup in.

Hi TJ,

Thanks for the reply. My setup is currently in the player class blueprint. What type of variable is the “First Person Camera” one that you have there?

HAHA! I spotted the problem based on your blueprint TJ!

I was using a Get Forward Vector from the vector list instead of the transform like you have. It fixed the problem and now all the players can use it the same way!

THANK YOU SO MUCH!

You’re welcome. I’m glad you got it working. :slight_smile: