Players not sticking to moving platform [2]

I made a similar thread yesterday - however due to lack of result and some terrible explaining(on my part); there was no sollution.

My underlying issue is

  • A platform being moved with BodyPosition and BodyGyros will not allow players to stick entirely to it. They will stay on top but slowly drift from their original position.

A quick breakdown of the game and current implementation
The game is based around a similar idea to Skeds VR Playgrounds - in which there are big users with VR sets who can interact with small users. In my implementation I do as follows:

  1. On VRService.UserCFrameChanged I move two parts locally to show as ‘hands’
  2. Right afterwards I fire the server with the location of these ‘hands’
  3. The server then updates a Body Position & Gyro to the location it is given
  4. The ‘sever hands’ are now synced with the client hands. With a slight delay.

Technical Details

  • The server hand is NetworkOwnership(nil)
  • The solid hands are entirely client-sided and have no impact on physics. They are just for tracking the controllers

EXAMPLE 1:
As you can see, even though the dummy sticks to the hand (for the most part) - he is slowly drifting off until he eventually falls.
https://i.gyazo.com/92d19cedf4b2aac01520d364d621ae1c.gif

People told me it was impossible to get this to work perfectly, but that simply isn’t true. Because with the following code:
(script.Parent is a BodyPosition)

script.Parent.Parent:SetNetworkOwner(nil)
local a = script.Parent.Parent.Parent.a
local b = script.Parent.Parent.Parent.b
while wait(5) do
    script.Parent.Position = b.Position
    wait(5)
    script.Parent.Position = a.Position
end

I get this (working) result:
https://i.gyazo.com/ca60251ea65230e9d288716a8dd5bd9e.gif

What I don’t understand is why the lower result works but the top one doesn’t - they both do the exact same thing; which is updating the position of a body position.

Here is my code from the (top) image.
CLIENT:

RUN.RenderStepped:Connect(function()
	local data = {rightHand.CFrame,leftHand.CFrame,head.CFrame}
	REP.remotes.data_update:FireServer(data)
...

SERVER:

REP.remotes.data_update.OnServerEvent:Connect(function(plr,data)
    local location = workspace.server_limbs:FindFirstChild(plr.Name)
    location.rightHand.BodyPosition.Position = data[1].p
    location.rightHand.BodyGyro.CFrame = data[1]
    location.leftHand.BodyPosition.Position = data[2].p
    location.leftHand.BodyGyro.CFrame = data[2]
    location.head.BodyPosition.Position = data[3].p
    location.head.BodyGyro.CFrame = data[3]
end)
2 Likes

Have you tries increasing the friction of the part in custom physical properties? Or maybe you can physically weld them on to the platform.

I’ve tried the first option, the second I’ve not really explored

Maybe consider a lower refresh rate for updating the location of where the VR hand is? Might be more delayed than prefered but it’ll ensure the player will stay on the hand more accurately as the many updates to Body Position might add the tiny micro amount of ‘float point errors’ to have a player slide off.

Maybe consider updating the position of the hand if the hand has moved more than a stud?

Maybe let the Roblox Server handle who owns the Network Ownership so whoever is standing on the hand will stay with it?

Neither works, though; I know there is some sollution to do it without rounding.

https://www.roblox.com/games/4337479096/skeds-vr-playground-READ-DESC?refPageId=08daf49f-99e4-473a-b730-d086b20473b1

Skeds, in the game above executes it perfectly.

Have you tried giving the network ownership of the part to the player and then moving the part locally?

1 Like

Perhaps manually CFraming the dummy onto the platform will work. I use this system with a train in my game. The train is moved on the server-side and then a local script moves the client to keep it in the same relative position.

1 Like

You should be able to adapt that system to work with an NPC as well, as long as it also uses a Humanoid.

I did this and this worked perfectly. I would like to really credit you on your sollution.

And yes I know everybody is face-palming of why this wasn’t tried earlier and the main reason was because:

  • It broke any physical interactions - due to replication.

Thus my final sollution was:

  • Have the server hand :SetNetworkOwnership()'d to the VR Player, and then have a secondary invisible hand that cannot collide with players or the first hand; which is NetworkOwnership()'d to the server. One deals with player platforming and the other physics.

Its messy but it works.

2 Likes