Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why is the character affected differently when standing on different types of rotating platform?

Asked by 6 years ago

Hi. I have inserted a basic block part as a platform and am rotating it. I have tried two different methods. The first using a surface motor and the second using the following code inside a loop to rotate the part:

workspace.Part.CFrame=(workspace.Part.CFrame * CFrame.Angles(0, math.rad(15),0))

The interaction between the player and the rotating platforms are different.

When using the surface motor method, a player standing on the platform moves with the platform as the platform rotates. This was the expected/desired effect.

When using the scripted method the player stays stationary as the platform rotates beneath their feet.

I would like to have the player move with the platform when the platform is rotated when using a coded method.

I am wondering why the player interacts differently with a platform depending on how it is rotated and what may be a better way to code the movements/rotation of a part so that the player will also be moved (without being welded or rigidly attached to the platform)?

1 answer

Log in to vote
0
Answered by 6 years ago

The player does not move when setting the CFrame of the part because the part.RotVelocity (rotational velocity) does not change. Roblox's motor already sets this for you and so when the player stands on the part, they are moved with it. It is difficult working with manually setting CFrame and velocity, and I could not tell you how to do it fully - but hopefully someone else with a better knowledge than me can explain to you how to do it.

1
Thanks for taking the time to reply. Oh, Wow! Roblox's motor is doing a lot more physics under the hood than I appreciated. Thank you for the explanation. Lyttlefreak 8 — 6y
Ad

Answer this question