Hello! I am currently making a slash attack, where the player will slash an axe, shooting out a slash projectile with rocks forming on the side of the slash. So far, the rocks that form will do a downcast, setting the material and color the the object it is touching. But a problem has occured: when the slash projectile clips into a part, the rocks also do aswell, having weird small rocks sticking out or not visible rocks at all.
The solution to this would be to position the slash projectile above whatever it is above / clipped through as the rocks get positioned based on the slash projectiles position, but I do not know a way to do that. My only idea is some sort of downcast, but I am not sure. Please help!
The rocks are created under a local script every heartbeat (by firing all clients), the slash is just one part that is being moved by a BodyVelocity, yes.
I’m a little bit confused to be honest, as the rock script that is supposed to be in a LocalScript means that you are passing Instances over remotes, which is bad practice.
Second, assuming you are running this every heartbeat and firing off to the client to run the calculations and visuals,
Are your map’s parts’ CanQuery set to true? I see that the color of the rock is still the grass color regardless of the raycast. Print if it is really hitting anything.
Your raycast will more than likely not hitting in this scenario because of the fact that you are already positioning your rock downwards and using that position as your origin point. Use the NewSlash as your origin point instead, with something like this:
The ray will have a Position key you can use to position your rock. Otherwise if it detects no parts, stick to some arbitrary position (or don’t render at all).
Here is a video showing that grass isn’t the only thing rendering, it was just the way the raycast was set up, I will be trying your solution to this now.
Also, I would like to position the slash above the things such as the grass, road, etc as the rocks are positioned to match with the slash and it would save me a hassle positioning those as well.
Your solution for mismatched color seems to work! Only issue now is positioning the slash above objects it passes over so the slash and rocks don’t clip through them.