Hello. I’ve been working on a 2.5D platformer and I’m trying to find a way to shoot projectiles at mouse location. Above the main character there is a floating weapon (for now replaced with an arrow component that will be parented to the gun mesh) that is supposed to rotate in such a way as to allow player to shoot enemies. I’ve been looking these days at several tutorials that could help me with this, but so far nothing works. I should also mention that I’m using Unreal Engine 5.00, in case that there are some changes from the previous versions that might interfere.
One of the things that I tried is from this thread:
Thank you very much ! I tried using your example script, and the arrow does indeed follow the cursor.
There is still a little problem. The arrow is not pointing just in XZ plane, it is pointing a bit outwards, in the Y axis. This could cause problems at a later stage, when shooting is implemented. I also tried to attach a gun mesh to the arrow, and it seems that the gun has another kind of rotation, in order to point outwards. I wonder how could I constrain the movement of the weapon/arrow in a single plane, like in 2D games.
Check if your character model is centered inside of the character actor. But to me it looks like your camera has an angled view on the scene. To fix this either remove the camera angle or adjust the solution to the follwing:
I verified and the camera doesn’t have an angled view. However, it is turned at -90.000183 ° on the Z axis. I’m not sure that that approximation caused the issue. Anyway, I tried using the modified script, and everything works well. Thank you very much for your help !