CFrame

0

  • short for Coordinate Frame
  • it is a data type used to rotate and position 3D objects
  • contains global X, Y, and Z coordinates as well as rotation data for each axis
  • contains helpful functions for working with objects in the 3D space
create a CFrame at a certain position and Euler rotation
local cf = CFrame.new(0, 5, 0) * CFrame.Angles(math.rad(45), 0, 0)
change the position of a part
game.Workspace.RedBlock.CFrame = CFrame.new(-2, 2, 4)
use Vector3 to change the position of a part
local newVector3 = Vector3.new(-2, 2, 4)

game.Workspace.RedBlock.CFrame = CFrame.new(newVector3)
point redBlock towards blueCube
local redBlock = game.Workspace.RedBlock
local blueCube = game.Workspace.BlueCube

redBlock.CFrame = CFrame.new(redBlock.Position, blueCube.Position)
offset
local redBlock = game.Workspace.RedBlock

redBlock.CFrame = CFrame.new(redBlock.Position) + Vector3.new(0, 1, 0)
rotate a part
local part = script.Parent

part.CFrame = part.CFrame*CFrame.Angles(math.rad(45), 0, 0)

https://developer.roblox.com/en-us/articles/Understanding-CFrame

  • 0 posts
  • 1 subtopic
  • 3 months ago by vince