Your projectile spawn location does not take the characters rotation into account X=>100 based on player location is always “East” of the character no matter what way he is facing, but that’s the only issue I can see with the BP, what exactly “does not work” when your function is called?
Yes projectile only respawns at east of the character, no matter where I put mouse or which direction character is looking. That’s what I meant for “does not work”.
That’s how I did it a while ago basically you need to setup a proper point of origin, for me it was the weapons world location, it made the most sense to me, you could also use sockets on hands though to shoot fireballs or something.
Although I do set my characters rotation to point toward the mouse cursor as well to “aim” in the right direction otherwise it might look strange, i do this seperately with an aim-stance but for something like diablo you would set actor rotation everytime the mouse is clicked together with handling the attack.
in controller call Get controlled Pawn, cast it to your characer blueprint and from there you can access any part of it such as your crossbow, then getting the world location of the mesh. this will fix the spawning location of your arrow but you can still shoot behind your character or sideways until you implement a character rotation towards the mouse.
Add your own spawn point then
Add Component → Scene
Drag the Scene on your mesh to Parent it
In the details of the scenepoint Select ParentSocket and select wichever bone the weapon is on (right hand propably)
now you just position it in the viewport to where your arrow should spawn.
You should rename the Scene, now when you cast the character pawn in any other blueprint you should be able to get a reference to this scene point and call world location on it.
Thank you for your answer. I did this but it almost respawns at the same location, no matter where the character is and its not like character is shooting, projectile just spawns not go through.
I don’t care about the second part anymore, just want it to spawn where I hit the mouse.
Man, this worked after I change the projectile with the one in FirstPerson Template of UE4. Thank you so much!
The last thing is, when the mouse button is hit, character needs to change his direction to that location. What should I add to do that?