MoveTo

Constructor:

MoveTo(position)

Description

Moves the Model object to this point with all movable objects kept in the same relative positions.

Parameters

Variable name Type Default Description
position Vector3 Target point to move to

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, move the Model object to this point with all movable objects kept in the same relative positions.

wait(2) -- wait 2
local part1 = RWObject.Create("Part") -- create part1
part1.Position = Vector3.New(0,1,0) -- assign a vector to the part1 position
part1.Anchored = true -- part1 movability assignment
local part2 = RWObject.Create("Part") -- create part2
part2.Position = Vector3.New(0,2,0) -- assign a vector to the part2 position
part2.Anchored = true -- part2 movability assignment

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
model:MoveTo(Vector3.New(0,0,5)) -- move the Model object to this point with all movable objects kept in the same relative positions