How to possess other physics ball pawn?

Hi everyone, i have a third person template with the ball of the rolling template ( tweeked the ball BP a little, i’m not using torque ) I followed the following video Unreal Engine Tip #1 Changing between Pawns and Possession - YouTube

The problem is when i move my first ball forward for example and posses the second ball all is fine but when i posses the first ball again the camera does some weird movements. ( first screenshot )

The second screenshot is my ball controller blueprint. I’m thinking if i need the unposses node or some kind of branch?

The third blueprint is my second physics ball blueprint, this is the same as my first physics ball blueprint.

If you have any idea’s on how to fix this please let me know and thanks in advance.

The way I did it is to attach the camera to a spring arm, and attach the spring arm to the pawn. Also, to move the pawn i directly applied the impulse to it along its forward/right vector. Your problem may be solved by clamping the pitch value in your LookUp() function. Attached pictures are my implementation.

139697-bp_mypawn_2.png

139698-bp_mypawn_3.png

Sorry for the late reply. My camera is already attached to a spring arm and the spring arm is attached to the pawn.

I can move the ball, the problem is when i move the “first ball” and possess the “second ball” all is fine, i have normal controlls over the camera.

When i possess the “first ball” again the camera attached to the ball goes in a weird axis as seen on the first screenshot.

When i move the “second ball” and possess the “first ball” the camera goes to weird axis ( because i moved the “first ball” to the “second ball” position )

If i then possess the second ball" again the camera does the same thing but in a different axis. It’s very weird.

How can i get the camera to not go in a weird axis when i possess another pawn?

Show me some blueprints please, i learn quicker with visual blueprints. Thanks in advance

I’ve updated my reply. Let me know whether it works for you.

Thanks for updating your reply. Everything works, only the InputAxis LookUp does not work for me.

When i don’t move the second ball pawn and possess the second ball pawn everything is normal, when i move the second ball with the first ball i can’t possess it annymore. Any ideas on how to fix that?

Another thing is when i possess the second ball and possess back to the first ball, the first ball goes flying in the air until it lands on the ground. I think this has to do with the collision or maybe there’s something wrong with the possess blueprint event. I have attached the possess pictures.

And the last thing i have is when i play in the editor i get a yellow ! warning saying physicsballBP_227.BallMesh has to have ‘CollisionEnabled’ set to ‘Query and physics’ or ‘Physics Only’ if you’d like to AddImpulse. I have no clue about this, it’s set to ‘Query and physics’ and i can’t set it to physics only. The collision enabled option is greyed out and i can’t change it.

Thanks in advance

Let me answer your 3rd question first. The thing is, you want the ball to have physics and be controlled as a pawn, instead of the latter alone. Correct?

In that case, you need to select simulation physics in the physics section of the static mesh, and set collision preset in the collision section to physics actor. That would enable the collision and set it to query and physics. The collision enabled option will remain greyed out unless the collision preset is custom.

Meanwhile you also need to ensure for each tick, the location of root component is aligned to this static mesh. See bp_mypawn_2.png of my answer. BTW, the static mesh should not be set to root component in this case. See bp_mypawn_3.png for my pawn setup.

I can’t tell what causes your 1st problem. You probably need to ensure the “can control” and “is ready” booleans are set correctly somewhere in your blueprints.

What is the meaning of “when i move the second ball with the first ball”? You unpossess the first ball and then possess and move the second one, or you collide the first ball with the second one? I read your screenshots. I’m not sure why the pawn is set to the location of a box or is set to hide in the game.

My advice is you probably should add a debug message showing the name of the pawn the controll has possessed each time you press 1. Also there is no need to have two separate blueprints for the 2 pawns. The logic to switch pawns should be placed in your controller blueprint.

Thanks for the reply. The “simulate physics” is already checked, the collision preset is a “PhysicsActor”, the collision enabled is already set to “query and physics”. I have the same setup as your blueprint of bp_mypawn_2.png and bp_mypawn_3.png. When i don’t connect the Root component i can move the ball but the camera is motionless and does not follow the ball pawn.

i followed this video on Youtube:
UE4 - Tutorial - Possession! (Request!) - YouTube That is where i got my possess blueprint from. The “can control” and the “is ready” booleans are from there. they are set up the exact same way as in the tutorial, the last part i did not do because i though i did not need it.

Yeah when i play in the editor i am the “first ball” and when i touch ( collide with the “second ball” ) after the collision i possess the “second ball” and the camera goes weird again. I have a box collision around my “second ball”, when i’m in this box i can press 1 and i possess the “second ball” But like you said i have to place the possess logic inside the ball controller so i’m going to do that and get back to you when i finished it.

Ok i found it. I already had some logic inside my ball controller. You can see it in the first picture. I press 1 and i possess the other ball, when i press 2 i possess the first ball again. That’s what i wanted. Everything works fine i can possess and unpossess between the 2 balls without a problem. I have deleted the box around the second ball. All works fine. I had some problems with the Y movement of the camera and i found the problem, it was the “clamp” node. You can see what i did with the “LookUp” node in the second picture. I can move the balls and the camera is sticking to the spring arm. I have no problems anymore.

I will thank you very very much for the time and your help on this. Your movement blueprints saved me. Thank you once again.

Oh sorry one more thing, i wan’t to roll through a box collision in the level and when i do there should be a check and when the check is true i can possess the second ball. How can i implement this the right way?

Also if you have the time check this forum: https://answers.unrealengine.com/questions/604260/question-for-video-tutorial.html

i want to get killed by a killbox in the level and respawn at the last checkpoint in the level but i don’t know how to implement it.

Many thanks in advance.

I believe there is no one canonical answer for your question, and it is all up to how you justify your design.

The way I would implement it is that:
In Pawn BP, implement the Hit event. When collision occurs, first check if this pawn is currently owned by a controller. If not, do nothing and return immediately. If it is, proceed to getting the owning actor of the colliding component using Get Owner method. If the owning actor is subclass of your pawn, the controller unpossess the current pawn and possesses the colliding pawn.

BTW, if you think the previous answer is helpful, could you upvote it and mark the question as solved? Thanks.

Yes no problem. Thank you for helping me :slight_smile:

Thanks. I will check your other question after work, in a couple of hours.