Download

Push and Pull force

Hello fellow creators, I love the idea of a gun that pushes or pulls your character.Let me give you an example.

You are on the floor and you shoot the ground by leftclicking to push yourself in the air,and while in the air you right click the wall ahead of you and it pulls you towards that direction.
The push and pull forces could be used to push or pull an enemy A.I. or an object but not fling it across the room.

I tried looking for tutorials but I couldn’t find any that matched my criteria,all i could find was a gravity gun from half life 2.
I am a beginner and was wondering if there are any tutorials or anyone who could explain how to create this.

Thank you in advance.

Start with this in the first person template and see how it goes:

vid: https://i.gyazo.com/57ab80e85914ea9aeca0d5d18a0dba93.mp4

Wow, thank you so much for your help.This is a great starting point.

And the next step could look like this function:

[IMG2=JSON]{“data-align”:“none”,“data-size”:“full”,“src”:“https://forums.unrealengine.com/core/image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==”}[/IMG2]​
Hooked up to the buttons:

vid: https://i.gyazo.com/c03c96b8bae26f6f…7291dc3c6c.mp4

somehow I missed that, do tell if you need it to work some other way than it currently does - as in apply constant force rather than an impulse

I didn’t expect such quick response and huge help.People like you are often underappreciated but please continue your excellent job helping others.Not all heroes wear capes!

Could you remind me how to enter the 1500.0 panel that is connected to return value and launch velocity.It’s been over 7 months i am a bit rusty.
And the 'yank and yeet ’
English isnt my first language so I will try to explain: When I right click i cant remember what to search for to get these panels.

It’s a function you create yourself, it’s in the first picture:

Rather than manually place multiple nodes, you can do it once and wrap it all in a function. Once you’ve made one, it can be then placed in the graph many times. More on functions:

https://docs.unrealengine.com/en-US/…ons/index.html

This is a multiplication node, in this case it’s *vector * float *- search for that.

The first step is a complete success.Now there are a couple of things I cant get right in the second step.
a) I have completed all the panels(if that is what they are called) except the first one.You have renamed it yank and yeet,but I can’t remember what to actually search to find this panel.
b) The last panel that is titled “Add Impulse At Location” there are 9 subcategories. I picked the first one, but I am not completely sure if it’s the right one.

Okay I finally got this working. I also added some cool-downs so that you cant spam push/pull.
But the problem is that when i try to pull an object it pushes it instead and i can’t find out why.

Never mind,I got this and it is working perfectly!! Thank you for everything friend.

What you refer to as *panel *is a list of function parameters. Do consider studying the link I posted and have a look at this one, too - it will answer a lot of your questions:

https://docs.unrealengine.com/en-US/…ons/index.html

For a tl;dr:

Select the nodes you want to have in a function, right click on any one of them an choose *Collapse to Function - *this will automagically create a function and incorporate the selected nodes. You will need to add the attributes to the panel. You can then plop that function anywhere in the graph and adjust the attributes as needed.

The ***Input and Output Parameters ***section in the above link explains it better than I ever could!

Oh, sorry. I cross posted!

Hello again.
I have created a grappling hook gun and it works almost perfectly.When i click the middle button the hook attaches to the ceiling and when I release it detaches.

1st problem: I don’t know how to make the rope visible.I saw a couple of tutorials but they were outdated because they clicked add component,but there is no add component in unreal engine anymore.I will attach how I created it the gun.

2nd problem: When I shoot the grappling hook to a ceiling it works perfectly, but when I shoot and hold it in the air my character floats before falling down.And when I shoot the ground and hold the button its like my character is standing on a pole. What I want is this:when I fire the grappling hook and miss, the character should fall down.

https://www.youtube.com/watch?v=s3KUmwc7zwQ&t=455s this is the link to the tutorial and at 8:10 is the visibility part.etheyjmsdyyhr.jpg

I don’t know what kind of maps will you have, but an early advice - try the push/pull gun on non flat floors i.e. sculpted landscape. LaunchCharacter doesn’t really like non flat floors.