@@ -609,6 +609,7 @@ class PhysicsSystem extends WorldSystem {
609609
610610 const anchorPoint = createAnchorPoint ( jointInstance , jointDefinition )
611611 hingeConstraintSettings . mPoint1 = hingeConstraintSettings . mPoint2 = anchorPoint
612+ JOLT . destroy ( anchorPoint )
612613
613614 const rotationalFreedom = jointDefinition . rotational ! . rotationalFreedom !
614615
@@ -642,6 +643,7 @@ class PhysicsSystem extends WorldSystem {
642643
643644 const anchorPoint = createAnchorPoint ( jointInstance , jointDefinition )
644645 constraintSettings . mPoint1 = constraintSettings . mPoint2 = anchorPoint
646+ JOLT . destroy ( anchorPoint )
645647
646648 const freedom = jointDefinition . prismatic ! . prismaticFreedom !
647649
@@ -839,6 +841,7 @@ class PhysicsSystem extends WorldSystem {
839841
840842 JOLT . destroy ( axis )
841843 JOLT . destroy ( unitAxis )
844+ JOLT . destroy ( anchorPoint )
842845
843846 const vehicleConstraint = this . createVehicleConstraint ( wheelSettings , bodyMain , maxAcc , urdfWheelBasis )
844847 const { listener, tester } = this . createVehicleListeners ( vehicleConstraint , bodyWheel )
@@ -869,6 +872,7 @@ class PhysicsSystem extends WorldSystem {
869872 const dofs = jointDefinition . custom ?. dofs
870873 if ( ! dofs || dofs . length < 3 ) {
871874 console . warn ( "Empty degrees-of-freedom in joint definition for ball constraint" )
875+ JOLT . destroy ( anchorPoint )
872876
873877 return
874878 }
@@ -922,6 +926,8 @@ class PhysicsSystem extends WorldSystem {
922926
923927 JOLT . destroy ( constraintSpecifications . axis )
924928 } )
929+
930+ JOLT . destroy ( anchorPoint )
925931 }
926932
927933 /**
0 commit comments