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’m trying to create a ball that isn’t laggy on the server and even less laggy on the client side and my best solution, linear velocity on line, has some strange quirks
What is the issue? Include screenshots / videos if possible!
The ball is flinging really far while touching the wall
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Assembly Linear Velocity (it worked but it doesn’t work sometimes for no reason)
Every other type of velocity with cloning the ball to match the ball on the server (I created a velocity thing and deleted it a couple milliseconds later so there might be a better way to make that)
Detected when the ball touches a wall then stops the velocity (i did it pretty sloppily so this might be a solution)
I appreciate
Different methods that you think will actually work
You could use the vector 2 of the linear velocity of the ball and find the normal of the wall. Then you could use the dot product formula to get the angle between the normal and the Vector2. Then you could cast another vector 2 from the normal of the wall where the ball hit with identical velocity (or less) to simulate a bounce off of the wall.
If you want the ball to just stop when it hits the wall though, I would recommend revisiting your implementation of that.
Hopefully this helps!
P.S. The dot product formula is a⋅b = |a|*|b| cos θ where a and b are vectors and θ is the angle between them.
You could maybe apply an small impulse with BasePart:ApplyImpulse() when a player ‘kicks’ the ball, this would make sure that the ball would slow down eventually and not cause much lag, unlike forces which move the part indefinitely until they are set to (0,0,0). Assuming the ball is a BasePart ofc
I thought imposing a velocity on it in a natural way instead of letting the engine do its thing might have helped. I haven’t worked with assembly linear velocity before but I read about it and thought you could just set it to whatever you wanted.
Sorry for the miscommunication tho hopefully you find what you are looking for!
oh ok thats interesting, like the kick just didnt interact with the ball? was it a logic or engine issue? did you run print statements through it? because really I think the jenkyness could potentially be solved here instead of a brand new solution. maybe?
I just raycasted using the linedirection of the linear velocity like every frame or something and then I halved the linevelocity to simulate the ball slowing down