Top down game with player character holding a gun. When I fire with the gun the projectiles goes to the desired location but when the character moves, there is a slight of the character body and rotation of the gun depending on the movement direction but the bullets does not rotate to that direction.
I use get rotation and location of the gun and then spawn the bullet but this does not helps.
How do you spawn bullets ?
Please show us a screenshot of your implementation, it will be very helpful to debug.
Hi DrFrancky,
To add to Victor’s suggestion, please feel free to post a gif or short video if it would help explain the exact behavior you are seeing.
[][1]
[1]:
I wish the bullets to travel on the red line (which later on I will use as laser pointer aim)
I think the problem is you are not actually getting the real rotation from the weapon tip. Not sure what “weapon” is, I am under the assumption that it’s the whole weapon.
A few ways to fix the rotation:
- Use a socket or scene component, place it at the tip of the weapon, use that as a reference for your rotation.
- Use the rotation of the laser beam
- Get control rotation
So, I haven’t done this, but if you are just pressing “UP” and “DOWN”, then there’s really no rotation going on. Doesn’t matter whether the character is being perceived as rotating or not. Unless you are actually controlling that rotation, no rotation will happen.
If you really think it’s your blueprint, then the only thing I can tell you that looks funky is that float multiplication. This looks like a Line Trace CP. So Weapon, going forward 50 uu. Anyway the easiest way to debug this, is to check the values coming out of your logic. Check what the rotation value by print string as you move your character around. If there is no rotation, read above.
Weapon is indeed the whole weapon.
The problem is that as you can see the whole torso of the character moves so does the weapon. I am using the weapon as start and forward vector and it should work because the weapon is rotated in that direction. but it does not work somehow.
The laser beam is a particle system with start and stop location set via blueprint.
I tried several different methods with same result.
How do people do that in topdown game mode ? This is something common I think.
Also , as you can see the laser beam works right. It gets the weapon rotation. Just the bullets are problem that’s why I think the problem is somewhere I’m my FireBulet procedure in blueprint. But I cant figure out what.
Yes I am pressing UP and DOWN (W and S) but as you can see in the video there is a rotation going on.
I use this 50 for moving bullets little forward of the spawning location so they look like are coming from the weapon tip and not the center of the weapon.
There are docs and plenty of tutorials online about sockets.
Don’t forget to do the proper research on your own so you can learn how to solve problems.
With that said, just ref the mesh, get socket location/rotation, input socket name, win.
Of course not. You are just moving up and down.
Even if I use the LaserImpact as a rotation this does not work. The LaserImpact is the tip of the aim beam. And when I move up, down, left or right it points to the right direction. But the bullets still goes to the wrong direction.
it seems like GetWorldRotation is not updated during moving.
But check the video, the weapon and the character ARE rotating slightly … like 10 degrees or so.
I think I narrowed down the problem, I have a hold fire key to fire action which auto fires until key is pressed. :
If I single fire everything is OK, the bullets go to the right direction. But if I hold the fire button they go to the wrong direction.
Here is the correct way to do it:
Having delays in Character Controller blueprint is not an option