I am making a hoverboard and I need to have the part always rotating so it is aligned with the rotation of the ground. How would I do this?
Aligning a part to the floor?
1 answer
So first you wanna find the rotation of the surface, let's call the part under the hoverboard "SurfacePart".
You would use this function to get the part rotation from its CFrame (The "x,y,z" values are the part position, while the other values are the rotation of the part)
local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz = SurfacePart.CFrame:components()
Then you would get the hoverboard CFrame (we will call it "newCFrame") by applying the rotation values to a new CFrame value.
newCFrame = CFrame.new(0,0,0,xx,-yx,-zx,xy,-yy,-zy,xz,-yz,-zz)
Of course you need to apply the board position, else the part will be placed at position (0,0,0). The board position would be called "Position" (Vector3 value)
newCFrame = CFrame.new(0,0,0,xx,-yx,-zx,xy,-yy,-zy,xz,-yz,-zz) + Position
You should read this to learn how CFrame works http://wiki.roblox.com/index.php?title=CFrame
1 comment
Of course you would rotate the newCFrame as you need.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Please elaborate on this. At the moment I'm not sure what to visualize; could you maybe show a picture?
I think he means that the hoverboard should be parallel with the ground.