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"

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 https://www.youtube.com/watch?v=UXFl_yWQjLs

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.

alt text

alt text

alt text

Product Version: UE 4.14
Tags:
more ▼

asked May 23 '17 at 09:16 PM in Blueprint Scripting

avatar image

gandalfini25
20 9 9 11

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

1 answer: sort voted first

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.

alt text alt text alt text

bp_mypawn_2.png (67.9 kB)
bp_mypawn_3.png (7.8 kB)
bp_mypawn_1.png (277.3 kB)
more ▼

answered May 23 '17 at 10:38 PM

avatar image

kingcrimson
66 5 10 14

avatar image gandalfini25 May 29 '17 at 08:28 PM

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

avatar image kingcrimson May 30 '17 at 12:10 AM

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

avatar image gandalfini25 May 30 '17 at 09:29 AM

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

avatar image kingcrimson May 30 '17 at 01:21 PM

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.

avatar image kingcrimson May 30 '17 at 01:38 PM

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.

avatar image gandalfini25 May 30 '17 at 06:51 PM

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: https://www.youtube.com/watch?v=RwtCfMMMt7M 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.

avatar image gandalfini25 May 30 '17 at 07:21 PM

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.

alt text alt text

avatar image gandalfini25 May 30 '17 at 07:25 PM

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?

avatar image kingcrimson May 30 '17 at 08:16 PM

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.

avatar image gandalfini25 May 30 '17 at 08:26 PM

Yes no problem. Thank you for helping me :-)

avatar image kingcrimson May 30 '17 at 08:38 PM

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

avatar image gandalfini25 May 30 '17 at 07:33 PM

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.

(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