How to throw a grabbed component with physics handle?
I managed to grab a component using a physics handle and GrabComponent(), I want to be able to throw my object, I can "throw" it by moving the camera right and left and release the mouse button, but I'd like to be able to right click and form a trajectory with the component with c++, how can I achieve this ?
Thanks for helping.
asked Dec 12 '16 at 11:59 PM in C++ Programming
I was facing the same problem, and I had solved it using UPrimitiveComponent::AddImpulse() function. Here's how I did it:
First, I made sure that I was saving the HitResult globally when line-tracing (ray-casting) on an object to grab. Then I retrieved the component being grabbed from the HitResult and applied an impulse on it.
In the above gist, bIsObjectGrabbed is a global Boolean which is set to true when the object is grabbed, and set to false when the object is released or thrown.
For some reason, if you hadn't used line-trace to get the HitResult, where how to achieve it:
Follow this question
Once you sign in you will be able to subscribe for any updates here