Hi there, first time posting a question!
So I’m doing something like a grappling gun. I was able to make the player to be pulled to an object with a collider using the single line trace for objects.
Now I want to fire a projectile (which is already done) and attach the cable to that projectile. The projectile I made will stick to a wall if it collides. I have a class blueprint named projectile, so I want to get the distance between the player and the projectile so I can set the distance of the cable.
My main objective is to press the RMB to shoot the cable, and if attached to a wall or something, when RMB is released the player gets pulled to the target.
Please help me, it’s for a christmas gift!!
Did you ever figure out how to do this? This is something that I would like to do as well.
I have achieved this by using line traces and cable components. However it looks ugly because the cable swerves around like crazy. It looks much better with spline components.
Here’s how I achieved an effect that is similar to the one in Just Cause 2. What you need to do is to first perform a line trace and get the hit location. You can use a spline component or a simple static mesh scaled proportional to the distance to draw the rope. Cable components can be used by attaching one end to the arm bone and the other to the hit point but they move around like crazy, so it’s not aesthetic.
The second part is to fly to the hit point by rolling in the rope. I did it with a timeline node. You basically create a lerp vector node to determine the location of your player and get the alpha from the timeline. This would make your character fly to the hitpoint always in the same duration regardless of the distance. To fix this, divide meters per second with the distance and set the play rate of the animation to that value.
I cant Attach/Set End Location for the cable, it sets it behind the character high up in the sky and its moving with the character.
Newermind only the Set End Location is still not working.