Pickup Ball Problem

hi, I’m pretty new to the ue4 blueprints.
I’m trying to make a character pickup a ball through the ball blueprint.
I’ve set a begin overlap to a box collider on the ball to enable the character and activate the pickup/drop events.
The pickup is supposed to place the ball in the position of the scene object “ball position” with a physics handle, but when I play test the blueprints stops at the branch after the LineTraceForObjects. The dropped event and the tick event for the position of the “ball location” seem to be working though.
What am I doing wrong?

Print out the hit value, it’s probably false.
also, maybe one of the Cast to is failing… set up a print string to flag the possible errors.

You’re right, the hit value is false. Do you know why?

Your “get forward vector” node is multiplied by a float of 0. Which would make your pick up distance 0. Set it to a higher value(1000) and test to see if it will still give null value.

Probably the fact you are testing only physics objects? You are also ignoring self as a result, so if this code is on the ball that’s probably why.
you said you did this on the ball…

Yes, this code is on the ball. So I unchecked the Ignore self. I want this blueprint to work when the ball collides with a third person player. So if physics body object type is not what I should test, what should I test?

Okay, reread through your code. You are getting null because of 2 things. Your trace is only looking for physics bodies, which are set in the collision settings. If you want the ball to trace, it needs to be pawn. 2nd is you are multiplying your get forward vector by 0. Which nullifies it’s range for the trace.

A better solution would be to move your dropped and picked events to the character blueprint. Setup the trace to go through the camera(replace mesh reference with camera reference). Set the float multiplier for get forward vector by 1000 or whatever the pickup distance you want it to be. You can also create your own object type and set the parameters to be the same as physics bodies and set that so it only works on your ball.

Bonuses for moving to character BP is no need for event tick, or the casts. Much more efficient in the long run.

Ok, I understand your solution to move the events to the character’s blueprint, but I need it on the ball, at least for now. But I made the changes you mentioned and now the hit value is now true (thanks for that). but the ball doesn’t lock on the location of the scene object “ball location”. My character blueprint owns a physics handle and a scene object “ball location”. Any idea?

In this example, I’ve added a vector arrow and static mesh(ObjectLocation) to the player camera on the character. Attached a physics constraint to ObjectLocation. In the transform for the static mesh, vector arrow, and physics constraint set their location to be where the object should go in relation to the character, in your case the ball.

This is code adapted from my game it is done from the player blueprint. There are somethings you will have to alter to get your desired results.