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

HOW TO MOVE THE PLAYER RELATIVE TO A ROTATING OBJECT?

Asked by 6 years ago

HI!

I'm just beginning with the platform and I am creating a game in which there is a giant rotating cube and each face has a board game and basically the objective is to stay on the cube and not fall from it.

The problem that I have is that when the cube is moving towards a certain position, the player is not moving relative to the cube, instead it's always going up making it almost impossible for the player to fall.

In the next example I only did it to go straight in the same direction for 50 positions and then to move straight to another direction and so on just to try it out.

How can I make the players to move relative or to stay attached to the cube when they are not moving instead of giving the impression that the player is moving towards the highest point of the cube's face when the cube is moving?

local speed = 0.3 

--MOVE towards the Y angle 50 times
for a=1, 50 do
        script.Parent:SetPrimaryPartCFrame(script.Parent.CUBO.CFrame *          CFrame.fromEulerAnglesXYZ(0,0.04,0))
        wait(speed)
    end

--MOVE towards the X angle 50 times
    for a=1, 50 do
        script.Parent:SetPrimaryPartCFrame(script.Parent.CUBO.CFrame * CFrame.fromEulerAnglesXYZ(0.04,0,0))
        wait(speed)
    end

--MOVE towards the Z angle 50 times
    for a=1, 50 do
        script.Parent:SetPrimaryPartCFrame(script.Parent.CUBO.CFrame * CFrame.fromEulerAnglesXYZ(0,0.01,0))
        wait(speed)
    end

0
try using Vectors? greatneil80 2647 — 6y
0
Instead of CFrame greatneil80 2647 — 6y

Answer this question