Hi, I’m a programmer and I have recently started to learn UE4, I come from a unity background and i’m finding that i’m getting tripped up on some of the differences between the engines, for example the naming standards and also the visual scripting.
I’m trying to create a mechanic that allows the player to pick up in game objects and hold them in front of the camera, similar to halflife and portal, and then place them somewhere in the world.
This job would be reasonably simple to do in unity, however given my lack of experience with ue4 I am not sure what approach I should be taking.
I guess I just need some guidance in whether I should use c++ or blueprint, and what technique some of you more experienced with ue4 would take to achieve this.
It was asked many times what blueprint is capable of, and the short answer for this is always: “It’s capable of everything, imagination is your limitation”.
Pickup objects are implemented in Content Examples demo, in physics level. Take a look, it’s pretty simple to implement with blueprints.
I believe the common approach is to find the object the player is aiming at with a ray trace and then create an appropriate physics constraint between the object and the player / players weapon.
I did get that far since that would be how I would have done it in unity, Raycast from the forward direction of the camera and use a tag to determin if the object is one you can pick up, then once you tap a key it parents the object to the camera and translates the object’s local by the cameras forward times by a distance away from the camera.
But there other ways I can think of, such as using the dot product of the camera vector to the ground and comparing it to the forward vector of the camera.
I just really want to make sure there’s no “do exactly what I want” function, or at least a chunk of what I wanted to do. There are many functions that are named quite similar.
Your link is a big help though, it gives me a way to study up on the many functions I have to play with. Thank you very much for taking the time to post this answer
Thank you very much, i’m downloading it now. Hopefully there’s something in there that is quite similar to what I want. Cheers and thanks for taking the time to answer
There is a ready-to-use component called physics handle(UPhysicsHandleComponent) that is used exactly for this kind of interaction, and more to say, it is how it’s done in the sample.
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.