Part doesn't lose velocity upon colliding

I don’t use bodyvelocity, I just set the velocity of the puck to move in a direction. However, I assume it has something to do with the networkownership change, it just goes around every object it collides with and continues forward. Is there any way to prevent this? Or stop it from happening as frequently as this?

Clip example:

1 Like

Are you just setting it’s velocity from the script or a body mover? Correct me if I am wrong but explicitly declaring its velocity like that causes issues with the physics engine iirc.

1 Like

I originally used a bodyvelocity but that issue was far too common, so I used the Part.Velocity property, and it happens still, but VERY slightly less frequently.

1 Like

What about a BodyForce? Could that help at all?

1 Like

I think what you should do is check its h value (in derivative mathematics this is basically like the offset of 2 points in terms of x and y, not magnitude) then see if the sum of them is within a certain thresshold, say 5. If it is you will set its velocity to a vector3 of 0 magnitude

1 Like

I have 2 scripts that constantly check in front of the part and make it slow down if it detects a part in front of it, I don’t think that would help, I think it’s a problem with networkownership because it lags it, you can even see it jitter a little on contact.

But if I were to attempt this, what would the offset be?

1 Like

network ownership is designed for clients to perform computational difficult things on their computers, such as flying a plane. You would have two values, x0 and x1 where x0 is the previous position and x1 is the one at the current render step (hint, use a modulo divisible of 2)

1 Like

So would I draw a ray between those two points and find intercepting parts? Or what would I do with those two points, because I do log the position before Stepped and after Stepped

1 Like

okay so suppose we have points

x0 = [10, 1]
x1 = [8, 5]

to calculate the h of these given intervals we compare x1’s components with x0’s.

h = [2, -4]

from there we simply get the average of these values

h= (2+-4)/2
h= -1

Now that we have h as a integer we can simply see if it’s absolute value is like 5 or less

2 Likes

Hmm, this might just be a case of the Roblox physics engine fart moments especially with how ice physics work, just look at games like whatever floats your boat with the moving land boats using an ice part.

Maybe a simple solution is to just make it lose velocity is to decrease the velocity when it touches a player.

--decrease current velocity by 20%
Part.Velocity *= 0.8
2 Likes

I can easily code that in, but exactly what does that do so I understand it. I don’t quite grasp what the point of doing that is.

1 Like

The problem is, it doesn’t detect the collision, so it doesn’t remove velocity. I track that manually, so I assume its some form of ownership change that lags it.

1 Like

Think of it as the combined scalar of two points on each axis ig

1 Like

I’ll test this out but I won’t be able to tell until later when I host a scrimmage with the new update, I’ll relay results asap.

2 Likes

I attempted your code but it wouldn’t deviate at all from 0. (i took the absolute value of the number) because it runs before every physics render, I think it runs too fast to detect major deviation yet the lag puck still happens some times.

1 Like

Still haven’t been able to figure this one out.

Anyone have a solution for this at all? : (

Hmm, maybe try comparing its vector to the previous vector. From there find what was the angle measure difference from these (see the law of cosines) if it is greater than say 120 we can guarantee that it had been collided with and we can then lower its velocity like @dthecoolest suggested

No, none of this worked, its doing a different version of the previous thing now. Instead of gliding along the part and then going in the same direction, it flat out teleports to another position then goes around the goalie. Has anyone ever experienced this? Any solution anywhere? I haven’t been able to find any other report of this.

I stopped using velocities and switched to bodyforce, I have 0 clue as to why this happened, it wasn’t a network ownership bug, etc. Idk if this is a roblox bug or how I executed it? But it’s fixed now.