So I got a simple side scroller, and I’m working on a boss which teleports and throws snowballs. My question is how do I make her always throw the snowball directly at the player? I’ve got it spawning, but I don’t understand how to set the spawn rotation of where the player is currently standing. I tried getting the players location and converting it to the spawn rotation, but no luck how would I do this?
Maybe you could try to get the “player location” - “boss location” = Direction from boss to player. Then you could use this vector to determine your projectile direction path. Hope it helps
Did you try setting your projectile velocity to the resulting vector? You can find a function called “SetVelocityInLocalSpace” with you projectile movement component.
I tried it and got the same end result. Where they are just thrown straight out from the facing direction
I made a YZ rot from player location-boss location. I also tried on Y rot and only Z rot, with the X rot (which is default make rot choice) they go straight towards the camera
How would I refrence the location of the boss and the player inside the bullet?
ok this has been very helpful thanks. I shall set it up that way I got it working but I think that would be much more memory efficient. What I have it doing now is 2 get all actors of class nodes and setting a var for the player and the boss, and I’m sure this is much more memory efficient thanks for all the help!
You could try adding a vector variable inside your projectile BP and make it editable and exposable on spawn.
That way, if you use it to set your projectile velocity inside your construction script, you will be able to send the trajectory directly from the boss to the projectile while spawning. Here’s some sample code
No problem, glad i could help