You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I have been trying desperately to make a gun that shoots in the direction the barrel points
Disclaimer
It’s an issue when the player animates or runs (Specifically running since I’ve animated over arm movements), as the barrel flails rather than shoots straight in front
but I haven’t come to a reasonable solution. I am trying to make a gun that has the ray starting at the barrel and projecting straight forward from where the character faces
- What is the issue? Include screenshots / videos if possible!
I have a few issues actually.
The first one would be this one:
As you can see, the ray often strays towards some sort of point that I haven’t made. As I turn you can see the ray going towards that imaginary point. I’m trying to find a way to stop that from happening as it affects gameplay. The ray doesn’t always go towards the players mouse (Which should be straight in front of them due to the forced shift lock) and It becomes problematic as seen here:
(This seems to happen with mouse.hit, viewpoint and screenpoint)
(Everytime the output moves the shot is registered)
Once again, a simple solution would be to stop relying on the mouse or screen, but that brings up the issue of when the player walks or their character animates a movement that’d put the gun off target a little.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried screenpoint, viewport point, mouse hit, and shooting from the barrel, but all have been proven faulty. I’ve also looked around but i honestly don’t know what to search for.
If anybody can help, give suggestions or make corrections, I’d appreciate it!