This command will attach the specified 3D object to a limb of another 3D object.

GLUE OBJECT TO LIMB Object Number, Second Object, Limb Number
GLUE OBJECT TO LIMB Object Number, Second Object, Limb Number, Glue Mode
Object Number

The first object number is the object we are attaching Second Object Integer
The second object is the one, we will attach too Limb Number Integer
The specific type of glue operation Glue Mode Integer
This value is an integer number such as 1.


This command does not return a value.


By attaching an object to the limb of another, the objects position, rotation and scale are entirely controlled by the limb. This technique can be used to allow a robot arm to easily grab and lift an item, or allow your hero character to hold and wear a variety of items. The parameters should be specified using integer values. An additional parameter allows a specific type of glue operation:

0 - regular glue object to a limb (default behaviour)
1 - wipe out frame orient, leaving position only (avoid hierarchy frame problems)
2 - wipe out child object position for accurate limb location placement

Example Code
hide mouse:cls 0:autocam off




make object sphere SecondObject,1

load object "models\model.x",ObjectNumber

load image "iron.jpg",ImageNumber

append object "models\extraanim.x", ObjectNumber, total object frames(ObjectNumber)+1

set object interpolation ObjectNumber,50

position object ObjectNumber,0,0,0

position object SecondObject,0,0,0

position camera 0,2,4

point camera 0,0,0

while mouseclick()=0

set cursor 0,0

print "press h to glue object to limb"

if inkey$()="h"

glue object to limb SecondObject,ObjectNumber,7,2

color limb ObjectNumber,7,rgb(255,0,0)


print "press j to unglue object"

if inkey$()="j" then unglue object SecondObject

print "press up arrow key"

if upkey()=1 then move camera  1:while scancode()<>0:endwhile

print "press down arrow key"

if downkey()=1 then move camera -1:while scancode()<>0:endwhile

print "press left arrow key"

if leftkey()=1 then turn camera left 1

print "press right arrow key"

if rightkey()=1 then turn camera right 1


while mouseclick()=1:endwhile

if object exist(ObjectNumber)=1 then delete object ObjectNumber

if object exist(SecondObject)=1 then delete object SecondObject

if image exist(ImageNumber)=1 then delete image ImageNumber

Community content is available under CC-BY-SA unless otherwise noted.