local Cube = vci.assets.GetSubItem("Cube") local Balls = {...} local Balloffsets = {...} for i=1,5 do Balls[i] = vci.assets.GetSubItem("Ball"..tostring(i)) Balloffsets[i] = Balls[i].GetLocalPosition() end function onUse(use) if use == "Cube" then local Cube_localPos = Cube.GetLocalPosition() local Cube_localRot = Cube.GetLocalRotation() local rotationAngles = Cube_localRot.eulerAngles --Adjustment of the balls for i=1,5 do local relativeDirection = Balloffsets[i] local goalPosition = Quaternion.Euler(0, rotationAngles.y, 0) * relativeDirection Balls[i].SetLocalPosition( goalPosition + Cube_localPos ) Balls[i].SetVelocity(Vector3.zero)--Make the velocity of the RigidBody 0 Balls[i].SetAngularVelocity(Vector3.zero)--Make the angular velocity of the RigidBody 0 end end end