RotationTo

Constructor:

RotationTo(rotation)

Description

Rotates all rotatable objects under Model according to the given angle.

Parameters

Variable name Type Default Description
rotation Vector3 Rotating angle

Return Value

Type Description
None

Examples

Create a model, a mesh part and a part. Respectively set the mesh part and the part as the children of the model, and perform split joint operation. Finally, rotate all objects under the Model according to the rotating angle.

wait(2) -- wait 2
local part1 = RWObject.Create("Part") -- create part1
part1.Position = Vector3.New(0,1,0) -- part1
part1.Anchored = true -- anchor part1
local part2 = RWObject.Create("Part") -- create part2
part2.Position = Vector3.New(0,2,0) -- assign a vector to the part2 position
part2.Anchored = true -- anchor part2
local model = RWObject.Create("Model") -- create a model
part1.Parent = model -- set the parent of part1 as the model
part2.Parent = model -- set the parent of part2 as the model
wait(1) -- wait 1
model:MakeSplitJoint() -- perform split joint operation to all part objects under Model
wait(1) -- wait 1
model:RotationTo(Vector3.New(0,90,0)) -- rotate all rotatable objects under Model