Here on day 3, I think I’ll experiment with adding an element to the entity screen with the robot, with an eye to first having it be independent, and then making it a child of the robot, to see if it’ll turn with him.

My current setup looks like this:

function setup()
    -- Create a new craft scene
    scene = craft.scene()
    scene.sky.active = false
    createGround(-1.125)

    -- Create a new entity
    myEntity = scene:entity()
    
    -- Set its model for drawing
    myEntity.model = craft.model("Blocky Characters:Robot")
    
    -- Adjust position and scale
    myEntity.y = -1
    myEntity.z = 0
    myEntity.scale = vec3(1,1,1) / 8
    
    ronEntity = scene:entity()
    ronEntity.model = craft.model("Nature:naturePack_061")
    ronEntity.x = -2
    ronEntity.y = -1
    ronEntity.z = 2
    ronEntity.scale = vec3(1,1,1) / 2
    
    -- Move camera back a little
    scene.camera.z = -4
    
    parameter.number("Rotate", 0, 360, 180)
end

We have that nice tree in there. I think there’s a shield in the assets, let me see if I can find that. Sure enough. If we change that tree code to look like this:

    ronEntity = scene:entity()
    ronEntity.model = craft.model("CastleKit:shieldRed")
    ronEntity.x = 0
    ronEntity.y = 0
    ronEntity.z = -1
    ronEntity.scale = vec3(1,1,1) / 4

We get a shield in front of our robot, and when he turns, it does not:

Now entities have parent and child fields. What if i set the parent of the shield to the robot, and the child of the robot to the shield?

That turns out to be more difficult than you’d think. Perhaps there is a way to add the shield but I’m not sure what it is.

Unable to find any documentation or examples, I blindly tried the code below, which has some of the shield parameters adjusted to change its position and size. It’s clearly positioned and sized relative to the parent. So, despite the children table being touted as read-only in the docs, clearly it isn’t. Now when I rotate the robot, the shield goes with him:

Late start today, and it’s time for lunch. I’ll stop on a success. See you next time!