The problem is that in this way, the character can only shoot enemies on the same height (so he can’t shoot enemies above or below him).
Any suggestion on how to solve this?
You programmed the node to do a line straight out from the player. If you want it to end elsewhere, you need to specify the location of the target in the ‘end’ vector.
This could be because of how rotation is set. Are you sure you got that right? You could always add a scene component and make it face “the right way” and use that as a start point…
Anyways since you click on the enemy actor I’m assuming you have a reference to it, so why not pull the world location of enemy and use that as end point for line trace? Just a thought.
Thank you very much for your suggestion! I fixed the problem by adding a scene component and using its rotation to point the target.
You were right about the fact that the rotation was not right… but I had to rotate the actor only in the X/Y axises (a rotation in the Z axis makes the actor bend, which is just horrible). Ideally, one could handle that by breaking actor’s body in lower body and upper body, then make only the upper body rotate… but that takes a ton of work to set up properly… and it’s not necessary for my game mechanics.