Vacuum on left mouse button

Hi there!
I had a question, I’ve been working on a game similar to Slime Rancher.

My question is, can someone explain to me how to make a vacuum activated by left mouse button? I’ve tried a few things but I’ve never worked with vacuum things in UE4 and don’t know anything about it.
Here’s an example of what I mean:

I hope someone can help me out.

I watched a bit of the vid, and I still have no idea what a vacuum mouse is. Can you explain?

I already made systems like this.
One using “radial force” component with a negative value.
The radial force obviously is spherical and can affect objects that shouldn’t be (not in the front range of the weapon for example).

My solution was to have my objects ignore radial force by default, so I can choose when they can be attracted. The good moment is when they are in front of the weapon, so I’ve added an invisible cone attached to the canon and when an object gets in the cone, it stops ignoring force, and when it gets out of the cone, it ignores force again.

Then it is just about the input, the force of the component was 0 by default, so it doesn’t attract anything until I press left mouse for exemple, on press it sets the radial force to -50 000 or whatever negative value sits best.
This is a physical approach that I prefer because movements look more natural.

An other way is to use a line trace aligned to the canon. When an object is hit by the trace, it activates a timer inside of this object. On this timer, the object changes its position (on le line object/weapon, but close to the object).

I hope this is not too confused :slight_smile:

Vacuum when the left mouse button is pressed, like in slime rancher (The weapon)

Thanks I’ll try some things out, do you still have a system like that lying around, I could use a demo to see what I’m working with, thanks again for your time!

Unfortunately most of my work from last years is lost. I still have a packaged prototype of this mecanism though, but here I’m using an impulse instead of constant force, don’t know if it is what you need

Then I don’t know, I never opened the example project you mentionned…

Everything would help, thanks for trying to help

I’m trying few things, I need to know if you want to be able to attract multiple objects or only one by one?

Multiple, not limit, as long as it’s in the range, and it has to go to 1 point, the gun’s muzzle. I’m currently using the first-person template, so also the first person gun. I’m on the good track but it still ain’t it, I’ve been working on it the whole day, currently it’s 2:22 AM and I started at like 13:30 PM… But there has to be something. For real, thanks for your time.

I’ve done something, working very well until you begin to walk…I’ll find why or try a different solution and keep you in touch :wink:

Alright, I’m gonna go to bed and check if I can figure something out in the morning, I don’t know where you’re from but good night and again, thanks for your help.

Yeah the brain likes to digest during sleep :wink: .I have same hour here, but it is not my time to sleep
No problem it is very interesting to make a vacuum !

Ok I think I’ve got something like in the video from your first post.

I’ve commented the code but tell me if there is something you don’t get, or if it needs improvements :wink:

Hi Grot13, I asked you for permission to open the file with my e-mail: , could you accept it please?

BTW, sorry for not answering the whole day, couldn’t go in my room the whole day cuz some things happened and my room had to be cleaned with chemicals (No nobody died, fortunately) thanks for all your effort.

No worries :wink:

I didn’t realized an authorisation was required sorry

Do you have discord or something? I would like to discuss some stuff with you. Btw it works perfect, couldn’t have done better myself. Thank you.

(If you use discord, you can add me: DeimosPlays#7375

Unfortunately I used to have a discord channel but not anymore…

Hi, you still have the code? ty