It doesnt seem like you have a condition (bool) attached to your WhileLoop. It looks like its checking for a condition to loop against, in your case if it is set to ‘true’, but it doesnt seem to be referencing anything. Possibly try to set ‘firing’ (Your bool) to the condition on the WhileLoop and see if this helps, though I am not sure if this is the cause of the crash.
For the fire direction, check out the first person character blueprint and see how they have done it. You will need to modify which actor your pulling the location/rotation from and set this to a bone (Or local offset) on the machine gun asset.
I fixed the fire rate issue, but now im having trouble with his aiming (all these objects are stand-ins until I get the mechanics working)
I can’t figure out how to get his bullets to aim wherever the camera is pointed
so imagine an aim icon in the center of the screen - wherever the player looks, the aim icon would always be in the center of the screen - this is where I want the bullets to go. Right now they are only traveling in the x direction the character is running in
The problem I’m having now is that inputAxis for the mouse is being used by the movement script (i started this off of the third person bp template) - and I’ve attached my gun to the character in the level bp, so it’s like they can’t talk to each other
I’m thinking all I need to do is take the same values that the camera receives and add those to the yaw and pitch for the gun, since the gun is positioned on the top center of the character in a socket, but I can’t get the two bp’s to share the information
Any other ideas are welcome, I’ll work on solving it with this method a bit more
the circled area controls input and moves the camera left and right, but it doesn’t do anything to the pitch of my gun when I apply it like this - but If I disconnect the input into Make Rot and type in a manual #, like 90, it changes the rotation of the gun 90 degrees
any ideas?
[edit] I plugged the float value of the inputAxis to a print string and noticed the values stay very low, like -10 to 10 depending on how fast you move the mouse, so I think that’s the thing i need to overcome… still trying to figure out a way to do this
Did you have a look at the First Person Template BP? That does almost exactly what you describe. I think you want to add the camera inside the Character BP, not in the level. You can just ask the camera component for its location and forward vector.
Yea, I 'm going to go back in and take another look at the forward vector - I moved the gun object into the character blueprint and I’ve got something almost working - you can see when the angle changes up or down the rotation of the gun goes off by a greater value, but when the target is closer to the horizon the aiming is more accurate
It’s still not aiming at the center of the screen, tho
[edit] Also the gun is pointed in the opp direction of the bullets (not sure why)
I ended up using the camera boom’s rotation and not the camera, so it makes more sense now to use the ( forward vector of the gun == forward vector of the camera )? I’ll try that now
Ah I understand better what you are trying to do not. Aiming in third person is a tricky problem! What you normally want to do is perform a trace from the camera, see what that hits in the world, then have your character aim at that point. There are lots of special cases you need to work around though, for example firing around corners, where the camera can see something but the player cannot.
I got something that actually kinda works well, thanks a lot James, forward vector was just what I needed!
I will bookmark this thread so I can come back to the trace method when I get a little better with this engine
The only thing I’m concerned with is I had to disable the collisions for my character because the bullets spawn at a modified socket for the gun, which is too close to the other objects around him, detonating all the rounds before they were ever able to leave the gun
also, when he jumps into the air, the characters body passes above my aim icon (currently a tiny square texture from essentials), so the aim icon shows in-front of the player - Does anyone know of a way to have the player occlude a HUD texture that’s being drawn to the screen, or is that pretty crazy