Position entity exactly in front of camera

Hi, I was under the impression that the following code would position my entity directly in front of the camera but it doesn’t seem to be the case…

this.cameraEntity.addChild(myEntity);//add as child to camera for positioning only
myEntity.setLocalPosition(new pc.Vec3(0, 0, -1));//position it ahead of camera

What is wrong with this?


Do you have any errors? If not, then what makes you think it doesn’t work? If that entity is a model, then your model has probably larger radius than 1 and your camera is still inside the model, making it not visible.