I’m trying to position my bullet to my barrel’s position in my FPS gun system. However, the position of my barrel is extremely inaccurate. At points, the y coordinate of the barrel is negative, despite the player’s camera being above ground. How could I fix this problem?
Use attachments. Put a attachment at the end of the barrel and use that instead.
Also, maybe the ground is below -100 y axis. The ground doesn’t mean 0.
I’ve already tried using an attachment and the same issue prevailed. The position of the attachment was the same as the position of barrel, therefore the attachment didn’t change much.
I had to do something Similar for my games gun system, i just used an attachment put at the barrel of the gun then referenced the attachment in a script and used WorldCFrame to read the position.
Well, what are you using as the ground? the baseplate? And really, there is nothing wrong with having negative Y axis. If your game breaks on the negative Y axis, then your code is just bad.
I understand that there is no problem with having a negative baseplate. What I don’t understand, however, is that the player’s barrel is positioned above the baseplate(which has a position of 0,0,0) and yet has a y coordinate less than 0. Therefore, when I position the bullet to the barrel’s position, it will be under the baseplate. I’m trying to figure out how to solve that issue.
Did you check the WorldCFrame of the barrel? The normal CFrame parameter is in Local Space relative to the parent. So the barrel position could be negative in local space but positive in World Space