So basically I made an enemy that shoots projectiles at the player but atm he only shoots projectiles in the direction he is facing, this is good and all but if a player is above or below the enemy then the projectile wont aim at him.
So my question is does anyone know how to make a projectile move towards the players current position? So far iv only found tutorials on shooting projectiles from a gun the player wields but nothing on enemies throwing projectiles at the player.
Any help would be great, thanks in advance -unholypimpin
This makes my enemy shoot in the direction he is facing, but its just a straight line which doesnt work to well except on flat surfaces. For example if i’m on a platform and the enemy is below the platform he will shoot in my direction(which is where he will be facing) but wont take into account that I am above him so the projectile wont shoot up at my z height. Pretty much he can only hurt me if we are both on equal ground.
Can anyone help me out here? I have yet to find any documentation on projectiles being aimed at targets. I thought something like this would be as simple as plugging in my characters location and preseto! my monster shoots at the player but no…
Can I suggest getting familiar and abusing the **** out of DrawDebugLine? I often find I have issues with rotation because rotators act a lot more complicatedly than vectors
Is that movement… a function? That takes a location and does what with it?
Also I’ve got a feeling ControlRotation isn’t what you’re looking for… If you print or debug the output you can see if it’s not supplying complete rotation. You may need to manually do that? I suspect you’ll find ControlRotation is only giving you one axis of rotiation
So will this fix my problem with the enemy aiming his projectile at a fixed height and allow him to aim at the player even if hes above or below him?
Idk if you have ever played classic shooters like doom but the effect i’m trying to reproduce is enemies that can toss projectiles at the players current position, that position isnt just the angle but also the pitch so the enemy could throw projectiles at the player who is running below him.
The problem with lookat direction is that you want to fire your projectile where you are aiming, and you want to be able to aim left+right+up+down is that correct? lookat would just fire it from you to the target regardless of the way you are facing.
And if I am correct, the problem you are having is that the left+right aiming aspect works but it’s as if you are always aiming at a flat level, never up nor down.
We need to know more about your targeting system, how you control up and down aiming, and you also need to debug that control rotator! Use a debug text or just print it to the console for ultra ease. I still suspect you’ll find the left+right rotation working but that it’s not supplying your up and down rotation. in which case you’ll need to take a step back and find out why it’s not doing that.
If in doubt… debug. debug! DEBUG! the built in tools are great
So I tried something else to get my projectile to fire at the player but still didnt work, I used a trace from the enemy to the player and the trace would spit out of the players location and right after that it would set that location as the recently spawned projectiles velocity. My projectile still doesnt move at all, here is the code i’m using. Can anyone see anything wrong with it or show me how to fix it?
You’ll just have to keep increasing the velocity until it moves, don’t be shy! You can see from my example I had to multiply by 25000. You can also experiment toggling the Vel Change checkbox to see what works for you.