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
Pick Up Object: ]
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.
answered Feb 09 '19 at 05:41 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here