GetJointPartList

Constructor:

GetJointPartList(recursive)

Description

Retrieves all part objects connected with the object itself by constraints and returns as a list.

Parameters

Name Type Default Description
recursive bool false Bool value, False by default. Seek objects indirectly connected or not. True: seek; False: do not seek.

Return Value

Type Description
table The table that contains all part objects in the constraints with the object

Examples

Create several parts. Add two constraints onto a specified part, and retrieve the part objects in the constraints with the part.

local p1 = RWObject.Create("Part") -- create part1
local p2 = RWObject.Create("Part") -- create part2
local p3 = RWObject.Create("Part") -- create part3
p1.Position = Vector3(0,1,6) -- assign a vector to the part1 position
p1.Anchored = false -- assign a value to part1 movability
p2.Position = Vector3(0,1,9) -- assign a vector to the part2 position
p2.Anchored = false -- assign a value to part2 movability
p3.Position = Vector3(0,1,12) -- assign a vector to the part3 position
p3.Anchored = false -- assign a value to part3 movability
p1:CreateJoint(p2,JOINT_TYPE.SplitJoint) -- constrain part1 and part2 in the form of SplitJoint
p1:CreateJoint(p3,JOINT_TYPE.SplitJoint) -- constrain part1 and part3 in the form of SplitJoint
wait(1) -- wait 1
local JointList = {} -- create an empty list
JointList = p1:GetJointPartList() -- retrieve all the parts in the constraints with part1
wait(1) -- wait 1
for k,v in pairs(JointList) do -- output the names of all the parts in the constraints with part1
    print(tostring(v.Name))
end

Create several parts. Add two constraints onto a specified part, and retrieve the part objects connected (including indirectly connected) by the constraints.

local p1 = RWObject.Create("Part") -- create part1
local p2 = RWObject.Create("Part") -- create part2
local p3 = RWObject.Create("Part") -- create part3
p1.Position = Vector3(0,1,6) -- assign a vector to the part1 position
p1.Anchored = false -- assign a value to part1 movability
p2.Position = Vector3(0,1,9) -- assign a vector to the part2 position
p2.Anchored = false -- assign a value to part2 movability
p3.Position = Vector3(0,1,12) -- assign a vector to the part3 position
p3.Anchored = false -- assign a value to part3 movability
p1:CreateJoint(p2,JOINT_TYPE.SplitJoint) -- constrain part1 and part2 in the form of SplitJoint
p1:CreateJoint(p3,JOINT_TYPE.SplitJoint) -- constrain part1 and part3 in the form of SplitJoint
wait(1) -- wait 1
local JointList = {} -- create an empty list
JointList = p1:GetJointPartList() -- retrieve all the parts in the constraints with part1
wait(1) -- wait 1
for k,v in pairs(JointList) do -- output the names of all the parts in the constraints with part1
    print(tostring(v.Name))
end