Hello, I am a beginner in Unreal Engine and I want to create a grappling hook that pulls the player for my first 2D game. I have watched several videos on YouTube, but unfortunately, they are all directed towards 3D. Therefore, I tried to create something using ChatGPT, but unfortunately, it does not pull the character. I would appreciate your help in guiding me in the right direction.
Real quick- can you explain which parts are not meant to be part of the code? Things like this are confusing when asking this question- if there CAN be a white line and there isnāt one going in, generally it will not do anything at all.
One think I will point out- anywhere you see a yellow (vector) pin, you can right click to ābreak struct pinā and get your X, Y, and Z separated. So what youāll do with that is youāll make sure your X or your Y, whichever is your unused one, is set to what it needs to be, and let the other two be what determines your new point. So youāll use āMake Vectorā and plug in your new X Y and Z.
Your set nodes on the upper part are not connected into any execution. They will not run. Your grappling custom event has the attach point as 0, 0, 0 which will always be the origin of the world. Iād recommend you have a different test location than this since itās a grappling hook. Maybe something higher in the air. Also in your grappling custom event you should set the input āAttach Pointā location vector as a variable like āTargetAttachPointā or something similar.
Thank you for your quick response! Iām not entirely sure which parts of the code should remain as is. Iāve been following tutorials and consulting GPT chat to adapt what was shown in the video to a 2D setting, which led to the current scenario shown in the screenshot. I apologize for the confusion.
investigated and tried to adapt the Blueprint a bit more, and I ended up with the Blueprint like this. This time, it manages to pull me for some reason, and the lines turn green. I think itās not working because it doesnāt detect the ground and walls, which is why itās red? I changed the code - Album on Imgur
I think the reason for this is as I stated above- you need to have your X (or your Y whichever is the one thatās locked) for your mouse traces be set to whatever your character is locked to. Only the Y and Z (or X and Z) need to be changeable- whatās happening is itās getting the traces either too close or too far away from the camera!
Hi, Thank you for the reply, Iāve seen your link and I tried to implement based on your comment, but Iām having a hard time can please tell me how can I adapt to my blueprint?
I tried, but it did not work. I also tried stripping down what was happening in the blueprint and came to the conclusion that a few things were not doing much of anything, and I ended up with this: