I’m creating a gun system, currently i use rays to define the part trajectory, and i tween the part to the destination, however, i’m trying to implement a way to know if the trajectory gets blocked or something.
For example, if a part blocks the trajectory, and the bullet touches that part, then it would register the hit.
I’m trying to use a Touched event for that, the only problem is that the touched event only works with unanchored parts, if you need the script you can ask me.
An example here, i made it so if the part detects a hit, it would turn red:
The results with the unanchored part:
The results with the anchored part:
I thought about updating the ray constantly, but the problem is that i would need to rescript the entire gun system, and another option would be using Region3, but i’m not sure if constantly updating the Region3 would be efficient.
Any help is appreciated. As i don’t know what should i do. Thanks for reading.