Why do my camera child nodes not appear?

185 Views Asked by At

I have a camera node that follows the player but when the player moves my hud moves offscreen. After doing some research I found that they won't move if I make them a child of the camera but with I implement the following code my hud completely disappears. I tried making the zPosition and size very large so I couldn't miss them if they were there. But even then they are still not visible.

self.camera = cam

cam.addChild(dpadButton)
dpadButton.position = CGPoint(x: 0, y: 0)
dpadButton.zPosition = 1000
dpadButton.size = CGSize(width: 4000, height: 4000)
dpadButton.xScale = 1
dpadButton.yScale = 1.3
dpadButton.name = "DpadButton"
dpadButton.alpha = 1

Also when I have self.addChild(dpadButton) 8 nodes appear at the bottom right but when I have cam.addChild(dpadButton) only 7 appear.

1

There are 1 best solutions below

0
On

I just forgot to actually add the camera node to the scene with self.addChild(cam) thanks @KnightOfDragon for helping