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"

Drop object against wall

Hello.

I am doing a game and I need to grab and drop objects. The grab method is done: I attach the object to my character and I can move freely for the map with it.

The problem is to drop the object. To drop the object, I simply detach the object and teleport to a point in front of the character. But when I am in front of a wall, the object places in the wall. I dont know how can I detect when the object is in the wall and move it to me at a position that doesnt exist collision.

I see videos of The Talos Principle and they do that, when you try to drop an object near a wall, the object puts in a free position and moves the player back.

Thanks for your time!

Product Version: UE 4.14
Tags:
more ▼

asked Feb 10 '17 at 05:21 PM in Blueprint Scripting

avatar image

Bahamut1892
27 2 5 12

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

3 answers: sort voted first

you're using "teleport", the teleport node returns a boolean, true if it could teleport and false if it couldn't, use a branch and if it's false then try to teleport to somewhere else, you can also use "SetActorLocation" instead of teleport and check the "Sweep" option, it will try to teleport to the dest location but let's say it stop moving if it find something in the way, so it will teleport the actor to just before the collision happens.

more ▼

answered Feb 10 '17 at 05:52 PM

avatar image

veccher
1.1k 31 17 66

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

The correct way to do this is by doing a raycast / line trace from it's current location to the target.

You need to do a line trace forward (with the length of your maximum drop distance + object size / 2 so you know that even when putting it down, it will not be placed half way into a wall in edge cases where the player is barely far enough away).

If you just sweep the player can place objects behind a wall if he is close to it and the wall is rather thin (because the sweep will not find anything wrong with the location. It just cares about whether or not the place is occupied. With the trace you can detect if there's something in between. If so you can calculate the size of your object, reduce it from the hit location and place it accordingly.

more ▼

answered Feb 10 '17 at 06:40 PM

avatar image

Erasio
5.9k 291 86 293

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

Hello, in my opinion you should use the Pick Up Physics Object. There some tutorial for this. but the 1st in google search is one from epic. https://wiki.unrealengine.com/Pick_Up_Physics_Object_Tutorial Cheer. Hope it help.

more ▼

answered Feb 11 '17 at 07:31 AM

avatar image

Denis Lambert
305 4 4 8

(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