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"

LineTrace puts a held object through the ground

I have created a system where when the player presses f, it will do a line trace and attach an object to a socket. I have another set of code to when the player right-clicks, it does another line trace and detaches it from the socket and teleports to the line trace end. It mostly works, but when I do it too close to me, either it will destroy the object or it will go through the ground. How do I fix this???

https://youtu.be/MZzm4cBtbtQ - Video showing the problem

Drop Object: alt text

Pick Up Object: ![alt text][3]

[3]: /storage/temp/267942-screenshot-68.png

Product Version: UE 4.21
Tags:
screenshot-66.png (249.3 kB)
screenshot-68.png (240.2 kB)
screenshot-68.png (240.2 kB)
screenshot-66.png (249.3 kB)
more ▼

asked Feb 08 '19 at 10:35 PM in C++ Programming

avatar image

HawkeyeTV
1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

on the release you would take the impact point and offset it so the box doesn't teleport into the wall.

Off the top of my head I think the formula would be. impact point + (impact normal * distance from wall/floor)

the "distance from wall/floor" is just a float variable that would give a bit of space from the floor on the release.

It won't work in corners and certain cluttered spaces. you could run a check by doing something like making a box collision and sending that through to the expected release point get all overlaping actors if that array has a length greater than 0 change the crosshair color to red and not allow the player to release the the box until he turns to face a valid surface.

more ▼

answered Feb 09 '19 at 05:41 AM

avatar image

IndieGameCove
633 3 3 10

avatar image IndieGameCove Feb 09 '19 at 05:44 AM

I probably should have asked first but what do want to happen on the release? do you want it to teleport some distance, just want it to fall, would you prefer in lerps to a location? if you want the teleport to location behavior you have my answer above, I haven't tested that specifically but I think it'll work.

avatar image HawkeyeTV 5 days ago

Here's a video that is similar to what I want to do. https://www.youtube.com/watch?v=ENygHHVdc18

avatar image HawkeyeTV 5 days ago

Thanks, it worked!

avatar image HawkeyeTV 5 days ago

Now that it works, when I right click in the air, it disappears. Is there a way to detect if the object is dropped in the air so that it just falls to the ground?

avatar image IndieGameCove 5 days ago

yeah looks like you already have a branch node so just use it to check if the return value of the linetrace is false then if it is detach the actor and turn physics on so it falls to the ground. i think you would use the keep world for the transform rule not sure though.

just turn the physics off before you pick it up. you can look at the vr template if you want an example.

avatar image HawkeyeTV 5 days ago

Yep that worked. Thanks

avatar image IndieGameCove 5 days ago

sure thing

(comments are locked)
10|2000 characters needed characters left
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