Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. Examples
  5. Parent To Player

Parent To Player

Platform Compatibility

PC Mac OSX Oculus Quest
X X X

Make this object attach itself to the player object, learn more about setParent for information on using this command and what it does.

Note, this parents the object to the player at the offset (or distance from Player) it currently sits at, so it needs to be placed in the scene close to the player object to appear attached.

1
2
3
4
5
6
7
if obj.firstRun() then
    player = obj.tryStore("Player")
   
    if player > -1 then
        obj.setParent(-1, player)
    end
end
Tags
Was this article helpful to you? Yes No

How can we help?