An odd Projectile behaviour


So I’m at the end of my project and I wanted to create a projectile attack for an enemy that shoot in the direction of the player character and I did however the result were less than good. The problem is when it shoots it’s always above the player character not directly at him which I don’t want so the targeting is off even when standing still.
So where I’m going wrong here? Also I’m using a scene as a the projectile spawn location.

Hey @Dark_Hawk_X! Welcome back to the forums!

A few questions to help get the ball rolling:

  • Is this 2D or 3D?
  • Would you mind sharing a video/gif of what you are experiencing?
  • Have you tried testing the attack on any other dummy objects?
  • How specifically is your projectile launching?

Any additional specifics you provide may go a long way in solving your problem!

ezgif-2-0bacfe8723
-2D
I think to a degree I understand the problem, through testing I found out that elevation is the problem because I placed the scene component on top of the enemy’s head and the projectile shoots thinking it’s position near the middle of the actor while actually it’s not there rather it’s on top, maybe I should re do it.

If your projectile setup is using “Initial Speed” in the projectile movement component, then the spawn transforms “Rotation” is what determines the trajectory the projectile will take.

So we want a rotation that points from the spawning point to the target point.


Now if your target location ends up being the floor (feet) simply break the target location and add to the Z axis.

1 Like

Pardon me but I don’t follow, I use scene component to refrence the spawn location which not the same type so should I just make a vector var and store the scene location.
Also how do you reference the target location which is the Player in this case.

The variables in my demo are for illustration purposes only.

Your enemy character class needs to get a reference to the player character. Use said reference to get its location.

Yeah the reference to the player is fine however where does my scene component fit in all of this it’s the desired spawn location and it doesn’t connect to. Could you recommend something better maybe?

At first I didn’t understand, took a break and been busy with other stuff.
I had an idea in mind returned to the topic and it clicked, thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.