JointBreak

Constructor:

JointBreak()

Description

Triggered when the constraint on the object is deleted or bears a break force.

Examples

Add two physical constraints to the part p1 object, and add an event to p1 of responding to constraint deletion. Then delete the constraint to see whether the event responds or not.

local p1 = RWObject.Create("Part") -- create part1
local p2 = RWObject.Create("Part") -- create part2
local p3 = RWObject.Create("Part") -- create part3
p1.Position = Vector3.New(0,10,0) -- assign a vector to the part1 position
p2.Position = Vector3.New(0,15,0) -- assign a vector to the part2 position
p3.Position = Vector3.New(0,20,0) -- assign a vector to the part3 position
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(2) -- wait 2
p1:DelAllJoint() -- break all constraints with other objects
function JointBreakEvent() -- define the method of deleting constraints
    print("Triggered when constraints are deleted")
end
p1.JointBreak:Connect(JointBreakEvent) -- the event of deleting constraints from part1