My idea for grabbing

I think we should have a “grab” button. When you press the grab button, we send out a raycast from the center of the screen to X distance away (to keep from the ray going to infinity and slowing down the game) We check the first thing the ray hits. (We exclude things that we may need to exclude, such as our own Actor, or maybe HUD elements. If our ray hits a grab able static object, we temporarily parent that object to ourself. Maybe we do this by taking the objects Transform, and adding (or subtracting) our transform. Then when we drop the object, we stop parenting it.

I think that is how we do it.

The questions I have (which I’m sure will be answered as I finish the video) are

How do we parent the chair? I don’t believe it would be a real parent child relationship, but rather something along the lines of adjusting the transform of the chair in relation to our Pawn’s transform.

Then of course my next questions, are how do we do this in code?

Whats funny is this is exactly the way I thought of before watching the solution. It’s done a bit differently, but I think this would work just fine too.

Privacy & Terms