Best way to throw object attached to a socket

So, I have 2 parts working I.e. object pick up system that attaches an object (BP) to x socket disabling its physics and the second part is dropping the said object (BP), enabling its physics back on. Now, my question is how do I make player throw the object? I have variables to check for attached object and is the object a throwable or not but whenever I try to throw the object it goes in random directions. I have tried, front direction node for player mesh multiplying it with the rotation of the socket. But value returned just throws the object randomly. Maybe it’s the socket rotation? Or the objects rotation itself which is localised. I couldn’t figure out so here I am. It’s late night here for me so dropping this question hoping someone who has stumble upon the same problem might be able to share some insights.

Addition: First of all thank you for the responses, though I tried 2 of the methods mentioned below. It didn’t work either due to lack of knowledge on this “set collision response to channel” node or I am just that dumb. So, since now I am free I decided to display the problem and the blueprint as well. Please, skim over it and if you see anything wrong kindly explain how can I fix that part. Looking forward to your responses.
Additionally, If I cant figure out I believe @ SeldinG solution would be best suited even though I would love to keep everything inside the 1 single instance of the object (Avoiding destroying and creating of copies).


As you can see first 2 drops are done using the drop object but when it used throw, the object goes brrrrrr!

I was running into the same issue - for me the solution was to make sure, that I moved the object outside of the collision mesh of my character so they don’t touch each other and then apply the impulse.

When you just detach it from the socket and turn on physics, then it will just bump away.

Maybe this helps.

As weberl said, if the object is thrown in a random direction it might due to physics and collision, i recommend you to use the Set Collision Respond To Channel node and make the collisions Ignore the Pawn Channel for a brief moment.
image

It should not if you do this, probably on both meshes:

	InPrimitiveComponent->IgnoreActorWhenMoving(Owner, true);

I use that on my character so it doesn’t stop walking as if it is hitting a wall while I hold something.

An alternative approach would be to have a new copy of the object spawned more like a projectile when thrown, rather than throwing the attached object.

I usually make multiple versions of each object:

-Pickup
-Equiped
-Throwable

And then I destroy the one I’m not using anymore. I find this cuts down on the headache of making one version that does everything. Because a sword, for example, has its pivot in the handle and should be designed with the blade pointing down X, which can make it awkward to throw. But a Throwable version can have the pivot centered. Doing it this way also allows for each one to have its own collision tailored for the intended purpose.

Then at the moment of throw, destroy the one in the hand and spawn the throwable one from the hand socket and set the spawning child to ignore its parent’s collision. You can use the forward vector of the player or the socket as the starting direction of the new object.

I tried using this node to no avail, Idk maybe I am using it wrong. I have updated the post with more information please skim through it maybe you will get the problem I have been unable to figure out? Thank you!

That would be my last resort I rather avoid making multiple copies!

I think you and @ weberl are probably correct so is @ UnrealCommunist but the issue is I dont seem to be able to stop the collision with the capsule on time. It is weird since I have been stuck here for past 2 days taking different approach everyday.

I think your issue is you’re not using the forward vector of your player to determine the throw direction of the object. I hooked up an example.

https://youtu.be/dmdl5hJXzg4

Oh wow, thanks for making a whole explanation video. Wasn’t expecting this haha. Finally worked out I did try out the forward vector before but maybe messed up some nodes around. Thanks for the help :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.