BodyVelocity Ball falling through map

I’ve been working on this Penguin game for some time, and I keep running into the same issue. The penguin movement and physical size increases and decreases are handled on the client. The issue is simple. After selling, which looks like this, which usually tweens nicely, however I removed it thinking it would solve my issue, the penguin behaves oddly, and wants to fall though the map. Here is what that looks like. The penguin is moved with a simple body velocity. This is what that function looks like that. If anyone could figure this out for me, i’ve been spending too much time trying to figure it out. Thanks!

``````	local adjustedPos = Vector3.new(hrp.Position.X,0,hrp.Position.Z) + (-hrp.CFrame.lookVector * (ppp.Size.Y / 2))

bv.Velocity = (adjustedPos - ppp.Position).unit*(hum.WalkSpeed * 2)

penguin.PrimaryPart.Attachment0.Position = Vector3.new(0,penguin.PrimaryPart.Size.Y/2,0)
penguin.PrimaryPart.Attachment1.Position = Vector3.new(0,-penguin.PrimaryPart.Size.Y/2,0)``````
1 Like

Perhaps your BodyVelocity’s MaxForce value is not strong enough to cancel out gravity’s effects on your penguin?

Also, check if all the parts in your penguin model are correctly attached to the part containing the BodyVelocity.

There’s only one part in the penguin model, the ball BasePart. The current MaxForce is Vector3.new(inf, 0, inf).

If the part cannot exert any force on the Y axis to counteract gravity, then your penguin will fall down, assuming it is not colliding with a floor, or the penguin has CanCollide set to false

The BasePlate is the floor. The penguins CanCollide is never changed. What Vector3 should I use to counteract the gravity? I want the ball to roll behind the player, not float.

So your penguin has CanCollide set to true, and there is a proper floor? If this is all true then I cannot think of any reason why your penguin is falling through the map.

What do you mean correctly attached to it’s moving part? I generate an adjusted position, which is always behind the player. I then set the Velocity of the BodyVelocity to `(adjustedPos - currentPos).unit*speed`. This glitch only happens after the ball mass is sold. That process goes like this.

Ball Touches SellPart;
Server is invoked, server changes leaderstats after running checks;
A true boolean is returned to the client;
The client anchors the ball, and removes all active forces (Vector3.new(0,0,0))
The client tweens the size of the ball to Vector3.new(2,2,2)
The client waits .5 seconds after the tween is completed, then un-anchors the ball;
If the ball size is 25,25,25, the ball falls a great distance, and slips right through the baseplate;
If the ball size is small, the ball seems fine, but upon collection fish, the ball seems to want to fall under the map.
The collection of the fish un-anchors and Disables Collision for the fish so it falls through the map. The ball syncs with that fall.

The size changing is only happening on the client, as well as removing all active forces.
I may be wrong, but some of these operations you are performing on the client might not be replicating to the server, causing discrepancies and ultimately the server overriding your client changes and making you fall through the map.

Try doing the same steps but executed from the server, and see if you encounter the same problems.

Will do.

The only issue I could see is the Network Ownership.

did you try actually testing it? did you run into the same issue?

I’m working on it now.

Nope, running into the same issue. https://gyazo.com/1ab433a56a367fe10ab4f2f2b64855ff

Strange.

What if you used a BodyPosition, with the BodyMaxForce Set to the same (inf,0,inf)
It would take a little bit of adaptation, but it would allow you to make the movement look smooth and exponential.

I already have a body velocity with the max force set to inf,0,inf

Are you setting the position of the ball to make sure that it doesn’t clip with the floor when it resizes?

1 Like

Setting the position makes the ball “Stutter” because of the constantly moving BodyVelocity.

The glitching of the ball only happens after the mass is sold, which the process is stated above.

Once you size the ball and anchor it on the client, move the ball’s position to its Position.Y + its Size.Y/2 to make it perfectly sitting on the surface of your floor, which would prevent it from clipping through the floor like @PlantChampion said.