How could I replicate this behaviour in blueprints?


I am trying to achieve a mechanic similar to this one: Tap Guns Android Gameplay - YouTube

However, I cant seem to get the behaviour right.

Heres my BP:

Heres what happens:

Note that due to me adding a rotation every tick (rotator didnt seem to work) it just doesnt let me add a launch up when right clicking. How could I make it more reliable and responsive? I tried with forces also though that was very incosistent and I had to add radial forces up to millions to get an effect.

And while we re at it, why do I have to add such high forces to get the object moving? And the threshold is very sensitive. Sometimes I have to go in the millions. Any idea why?

Thank you!

Try to set Movement Mode to Flying and just Launch Character. You can get similiar or the same results.

im not using a character movement component :frowning: i mainly need the spin behaviour and shooting to work consitenly.

anyone? if someone got some pointers it would be aweosme. :slight_smile:

I think you could do it totally with physics or BP.

If physics, then you can put the 2d constraint in. You have add impulse and gravity, friction etc.

If you do it with BP you can move it upwards, with a tendency to downwards, also 2d rotation, and so on.

I don’t a mix will be good.

can you elaborate pls, I may be unfimilar with the 2D functions, do you by any chance have discord.

Not 2D functions, but phyics constraints. You can make object respond to physics, but not allow movement in certain axes etc:

I’m afraid I don’t have a discord.

oh yea, i have the physics constraints on the details panels locked already, but im still not getting a rotating movement. I just dont know how i could make the character rotate with a custom amount when i apply force? It doesnt rotate but just goes up. Even tried force at location and the location being an edge but still wouldnt make it roll…

Yeah, that’s why it might be easier in pure BP. I’m not a big physics buff myself. I assume it is possible, but might require a lot of tuning.

In the vid, it looks like code moving the gun.

yea i would be fine with that behaviour as well. But if add a tick rotation it somehow pushes the cube as well.

I think you’re going down a dead end if you try and combine BP and physics.

I have something which is only physics here, that -sort of very slightly- looks like the vid. Will play with it a bit more…

please keep me updated. Im running on dead ends…

I was able to slap something simple.

It only uses physics, which means, like @ClockworkOcean said, the tunning of the forces, dampings and constrains can be a real nightmare. It works but … it’s physics, so, I don’t actually recommended it.

The gun (the arrow represent the muzzle, which must be offset from the center):


The control:

Perhaps someone else can suggest something more controllable.

So I tried a bit, naaa, it’s ■■■■.

I don’t know much about setting up physics, but I’m getting a pretty strong impression it’s code controlling that gun, not finely tuned physics.

I’ll have a bit more of a think about a way to code it…

As you can see, it move in a similar way. No physics. But you’ve got your work cut out.

The BP components are just two meshes to make the gun ( the particle system is just to make it look like it’s firing ), and a ‘scene’ so I can dictate where the gun pivots:

I use F to fire the gun:

Fire just turns the particle system on and off. Then I use a timeline to move the BP 250 units up in the world.

Tick is already getting a bit fiddly, and we haven’t even started:

The first part is always moving the gun downwards, so it falls gracefully if nothing is done.

Second part gradually resets the rotation speed back to zero, meanwhile rotating.

Third part is always trying to reset the gun back to it’s neutral starting position. So it the player doesn’t fire for a while it will just assume and upright position.

Good luck… :-/