Download

Physics handle to work for individual players

Hello there,

I am having trouble with a second player physics handle. Basically when I create a second player in game it is a derivitive of the main pawn class where there is a physics handle, grab function and fire object function. The problem is that the second player will grab the first player out of the air regardless of where they are placed on the map while the first player grab function will continue as normal. Below are the blueprints that I am currently using to create the grab function of my game.

Grab Object

Drop Object

Physics Handle
b80969744dcd1c7b56c19cd3f6252cb45ca98cc6.jpeg

And the rest
97138b4162dd93b6bdd06533c6107ec740ceefcd.jpeg

So I guess what I’m looking for really is a way to tell blueprint not to derive instructions just from Player Controller 0 and that when a new player is added, take the controller, camera and pawn instructions from player controller 1 or whichever new player has entered the game as well. The major issue with that is I cant see a way around it without affecting the basic components of these functions.

Can anyone lend a hand with this?

Thanks

Where is this all placed? Is it inside your character/pawn BP or Player Controller?

In the Player Controller you can get the controlled pawn/character and gets it’s location and rotation from that.
If you’ve got it in the pawn/character BP you should be able to get location/rotation from the camera directly.

Hi thanks for the reply,

It’s all within the pawn BP at the moment. So you’re saying I could move some of these blueprints to the player controller BP and then I won’t need to make refenrece to specific player controllers? Does that include the player camera manager as well because when the object is fired from the player it takes the direction from the camera view.

Yes you can move it to your “Player Controller” and just get a reference to self in the corresponding places. As for the camera, your pawn/character should ideally have a camera inside. All you’ll need to do is get the controlled pawn, cast to the BP Class and get the camera. From this you should be able to get it’s location and rotation.

I have given that a go and I seem to be having a problem with the casting. This is what I have so far.
8269968d6809b9f6d5b1bc314468e194411bea5d.jpeg

So based on what you have said I have moved the grab object, drop object and update physics handle functions to the Player Controller blueprint and have done the casting in the event graph of the Player Character after the Check Trace function. Each time I try to grab an object it fails and as far as I can see I have referenced the casting correctly. Does it look right?

Also am I even correct to use functions or should I make these custom events?