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 pickup and drop obj on third person blueprint?

Hello Everyone,

I followed this tutorial to pickup objects up and drop them on pressing "f": https://www.youtube.com/watch?v=OltZ-xFz8IQ

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?

alt text alt text

Product Version: UE 4.12
Tags:
picture5.png (922.5 kB)
picture6.png (1.1 MB)
more ▼

asked Feb 11 '17 at 06:37 PM in Using UE4

avatar image

Hoda El-sayed
2 3 5 7

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

1 answer: sort voted first

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.

more ▼

answered Feb 11 '17 at 07:12 PM

avatar image

TestyRabbit
356 7 6 13

avatar image Hoda El-sayed Feb 11 '17 at 07:41 PM

+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

avatar image TestyRabbit Feb 11 '17 at 08:09 PM

You can try using these 2 ways. Would look something like this:alt text

avatar image TestyRabbit Feb 11 '17 at 08:24 PM

Those ways don't fully work. So I have modified your way to account for the distance between the camera and the player: alt text

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.

avatar image Hoda El-sayed Feb 12 '17 at 12:08 AM

+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 alt text Output is: alt text

picture7.png (939.7 kB)
picture8.png (632.3 kB)
avatar image TestyRabbit Feb 12 '17 at 12:19 AM

Can you print out what your linetrace is hitting when you press f? It might be colliding with your character model

avatar image Hoda El-sayed Feb 12 '17 at 12:40 AM

+TestyRabbit Hmm.. well surprisingly it prints nothing when I press f near the cube on the blueprint alt text

picture9.png (1.0 MB)
avatar image Hoda El-sayed Feb 12 '17 at 12:13 AM

+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

avatar image TestyRabbit Feb 13 '17 at 01:57 AM

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

avatar image Hoda El-sayed Feb 14 '17 at 06:58 PM

+TestyRabbit

ok now it prints the shape_cube name correctly but still doesn't pick up or release it alt text code: alt text

picture1.png (479.5 kB)
picture2.png (917.2 kB)
avatar image TestyRabbit Feb 14 '17 at 07:15 PM

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.alt text

126283-picture2.png (665.4 kB)
avatar image Hoda El-sayed Feb 14 '17 at 08:13 PM

It gets stuck at the 2nd branch -- it gives false not true and thus it doesn't grab or release component alt text here is printed because it returns false not true alt text

picture5.png (666.8 kB)
picture6.png (687.1 kB)
avatar image TestyRabbit Feb 14 '17 at 08:20 PM

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.alt text

untitled.png (62.7 kB)
avatar image Hoda El-sayed Feb 15 '17 at 07:51 AM

+TestyRabbit thank you so much, that actually worked :) I really appreciate your help.

avatar image Hoda El-sayed Feb 15 '17 at 08:04 AM

+TestyRabbit now the pickup works but drop item doesn't any idea what might be the reason?

avatar image Hoda El-sayed Feb 15 '17 at 08:07 AM

+TestyRabbit also it picks up the cube without me press f just when it hits the object automatically

avatar image TestyRabbit Feb 15 '17 at 06:55 PM

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.

avatar image Hoda El-sayed Feb 16 '17 at 11:52 AM

+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"?

avatar image HuayTa Feb 22 '18 at 03:27 PM

I was having issues with this too. To fix it you just need to unlink the Set target location node from the LineTraceByChannel and replace it with the Pickup Custom event. alt text

pickup-custom.png (86.9 kB)
(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