TheSilverDude

Untitled

Apr 4th, 2026
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.50 KB | Source Code | 0 0
  1. @name Slvr_BoneParentingGuide
  2.  
  3. @inputs
  4. @outputs
  5.  
  6. @persist [O E HED BODY SP1]:entity
  7.  
  8. if(first()|duped()){
  9.    
  10.     # Base variable setup
  11.    
  12.     # SCALE is a debug variable. Set to 0 for regular use!
  13.     SCALE=0
  14.  
  15.     E=entity()
  16.     O=owner()
  17.    
  18.     # Create the holos used for the body itself,
  19.     # This is better than relying on the actual player skeleton. This also makes it usable in sandbox!
  20.     # Two are required as separately some bones are broken.
  21.    
  22.     BODY=holoCreate(1005,E:pos(),vec(1),E:angles(),vec(255),"models/willardnetworks/citizens/male07.mdl")
  23.       holoParent(1005,O)
  24.       holoBonemerge(1005,1)
  25.     BOD2=holoCreate(1000,E:pos(),vec(1),E:angles(),vec(255),"models/Humans/corpse1.mdl")
  26.       holoParent(1000,1005)
  27.       holoBonemerge(1000,1)
  28.    
  29.     # Makes them invisible,
  30.     # Not rendering the models entirely sounds better but on rare occasion that breaks the entirety of the bones
  31.    
  32.     BOD2:setMaterial("effects/ar2_altfire1b")
  33.     BODY:setMaterial("effects/ar2_altfire1b")
  34.    
  35.     # Bone setup,
  36.     # DO NOT TOUCH THIS IF YOU DO NOT KNOW WHAT YOU'RE DOING.
  37.    
  38.    SPINE1=BOD2:getModelBoneIndex("ValveBiped.Bip01_Spine")
  39.    SPINE3=BOD2:getModelBoneIndex("ValveBiped.Bip01_Spine2")
  40.    HEAD=BOD2:getModelBoneIndex("ValveBiped.Bip01_Head1")
  41.    RSHOULDER=BOD2:getModelBoneIndex("ValveBiped.Bip01_R_Clavicle")
  42.    RUPPERARM=BOD2:getModelBoneIndex("ValveBiped.Bip01_R_UpperArm")
  43.    RLOWERARM=BODY:getModelBoneIndex("ValveBiped.Bip01_R_Forearm")
  44.    LSHOULDER=BOD2:getModelBoneIndex("ValveBiped.Bip01_L_Clavicle")
  45.    LUPPERARM=BOD2:getModelBoneIndex("ValveBiped.Bip01_L_UpperArm")
  46.    LLOWERARM=BODY:getModelBoneIndex("ValveBiped.Bip01_L_Forearm")
  47.    RTHIGH=BOD2:getModelBoneIndex("ValveBiped.Bip01_R_Thigh")
  48.    RCALF=BOD2:getModelBoneIndex("ValveBiped.Bip01_R_Calf")
  49.    LTHIGH=BOD2:getModelBoneIndex("ValveBiped.Bip01_L_Thigh")
  50.    LCALF=BOD2:getModelBoneIndex("ValveBiped.Bip01_L_Calf")
  51.    
  52.  
  53.    # Holo setup
  54.    # Same as above, don't touch this.
  55.     SP1=holoCreate(1,BOD2:pos(),vec(SCALE),BOD2:angles())
  56.         holoParentBone(1,BOD2,SPINE1)
  57.     SP3=holoCreate(2,BOD2:pos(),vec(SCALE),BOD2:angles())
  58.         holoParentBone(2,BOD2,SPINE3)
  59.     HED=holoCreate(3,BOD2:pos(),vec(SCALE),BOD2:angles())
  60.         holoParentBone(3,BOD2,HEAD)
  61.     LUA=holoCreate(4,BOD2:pos(),vec(SCALE),BOD2:angles())
  62.         holoParentBone(4,BOD2,LUPPERARM)
  63.     LLA=holoCreate(5,BODY:pos(),vec(SCALE),BODY:angles())
  64.         holoParentBone(5,BODY,LLOWERARM)
  65.     RUA=holoCreate(6,BOD2:pos(),vec(SCALE),BOD2:angles())
  66.         holoParentBone(6,BOD2,RUPPERARM)
  67.     RLA=holoCreate(7,BODY:pos(),vec(SCALE),BODY:angles())
  68.         holoParentBone(7,BODY,RLOWERARM)
  69.     RTH=holoCreate(8,BOD2:pos(),vec(SCALE),BOD2:angles())
  70.         holoParentBone(8,BOD2,RTHIGH)
  71.     RCA=holoCreate(9,BOD2:pos(),vec(SCALE),BOD2:angles())
  72.         holoParentBone(9,BOD2,RCALF)
  73.     LTH=holoCreate(10,BOD2:pos(),vec(SCALE),BOD2:angles())
  74.         holoParentBone(10,BOD2,LTHIGH)
  75.     LCA=holoCreate(11,BOD2:pos(),vec(SCALE),BOD2:angles())
  76.         holoParentBone(11,BOD2,LCALF)
  77.     LSH=holoCreate(12,BOD2:pos(),vec(SCALE),BOD2:angles())
  78.         holoParentBone(12,BOD2,LSHOULDER)
  79.     RSH=holoCreate(13,BOD2:pos(),vec(SCALE),BOD2:angles())
  80.         holoParentBone(13,BOD2,RSHOULDER)
  81.        
  82.     # Usage guide:
  83.    
  84.     # This parents a simple holo cube to your left upper arm:
  85.     holoCreate(100,LUA:toWorld(vec(0,0,0)),vec(1,1,1),LUA:toWorld(ang(0,0,0)),vec(255,255,255),"")
  86.     holoParent(100,LUA)
  87.        
  88. }
  89.  
Advertisement
Add Comment
Please, Sign In to add comment