On my aim trainer, bullet impacts appear outside of the target because of bloom(bullet spread).
how do i fix this?
ive tried adding colliders on the outside to delete them but that wont work bc the bullet impacts dont have colliders and cant have them.
to see if its outside the bounds of the target but for some reason, they wouldn’t show even when they were in the bounds. i even made it so the bullethole script was called before the gun script in execution order
This script probably didn’t work because you’re checking the bullet hole’s worldspace position, not its position relative to the target. I am going to venture a guess that the center of the target isn’t at the exact worldspace origin.
If these are child objects of the target, use transform.localPosition instead. Also use Debug.Log to actually output that data, so you’re not shooting in the dark
But there may be some way to mask parts of the bullet holes which extend over the edges. I’m not really that knowledgeable in that area so not too much help.
i tried attaching the code i wrote previously to my gun script after i parented it to the target but it still didn’t work. i paused the unityu project and it showed that it was within the bounds but it still was set to inactive
i used localposition instead, now it shows the actual bullet holes but some are still sticking over the edge
If “bH” is the bullet hole, why aren’t you checking the localposition of the bullet hole? You’re checking the local position of whatever object the script is attached to instead. Also, output the data so you see what is happening.
If the point of the script is to check where the bH object is positioned relative to its parent, then yes. The way you had the script originally written made it seem like the script was actually attached to the bullet hole object. But that’s apparently not the case anymore. I’m assuming now the script is attached to the target. But please, output the data so you know what values are actually happening. Then if the script still doesn’t work, you will immediately know exactly why, instead of playing this silly guessing game.