Instead of shooting the linetrace out from the 3rd person camera, you want to shoot it out from the player controller or the player. The first person camera works because it is where your player is, the third person camera is behind your camera, so chances are your raycast isn’t hitting anything. I would get your player location and shoot it from the player’s forward vector instead.
Hello Everyone,
I followed this tutorial to pickup objects up and drop them on pressing “f”:
I got the same result as the tutorial but they are using first person blueprint and I want to do so on third person blueprint between 2 actors… I don’t get the same output on third person blueprint (see images)
I used follow camera instead of first person camera but nothing actually happens… Any idea how to make it work?
Those ways don’t fully work. So I have modified your way to account for the distance between the camera and the player:
Notice how I add the forward vector * 300 to the location in order to get the line start, and then add forward vector *600 to the location to get the line end. You can tweak the numbers, but just hook up the new line start and line end to your thing and it should be working fine.
+TestyRabbit can u plz show me on UE4? I am kinda confused on how to connect get player controller to the line trace or the get forward vector
+TestyRabbit
Thanks for the clarification… I did the 2nd solution. It didn’t work still though. It’s showing a blue line trace that moves with the character but still I can’t pickup the object or drop it when I press “F”.
Please help, I know there is something wrong with my code but I just don’t know what it is exactly.
Here is my code
Output is:
+TestyRabbit
I didn’t get how to connect the code in 1st way to my code… I would appreciate your clarification on it… Thank you
Can you print out what your linetrace is hitting when you press f? It might be colliding with your character model
Sorry for the late reply. Remove the draw debug line node and put the start and end values into the line trace node where they should go. I was using draw debug line to test out where the linetrace would go
+TestyRabbit
ok now it prints the shape_cube name correctly but still doesn’t pick up or release it
code:
It gets stuck at the 2nd branch – it gives false not true and thus it doesn’t grab or release component
here is printed because it returns false not true
The only reason I could see it not picking it up is if your cube isn’t simulating physics, and is therefore failing the “Is Simulating Physics” check. I have attached an image to show you were to print to see if this is the case. Check your cube you’ve placed into the scene to see if it is simulating physics.
That’s what I imagined. so go into your editor, click on the cube you are trying to pick up, and make sure the simulate physics tab is checked under the physics section.
+TestyRabbit thank you so much, that actually worked I really appreciate your help.
+TestyRabbit now the pickup works but drop item doesn’t any idea what might be the reason?
+TestyRabbit also it picks up the cube without me press f just when it hits the object automatically
It picks it up automatically because your Event Tick function is attached to the Set Target Location node. that probably is why it’s not dropping either.
+TestyRabbit when i break the link from event tick to set target location, nothing works… any idea how to fix this to let the pickup and drop process starts only when I press “F”?