I have a set of objects that were originally children of a blank node, and via code they are supposed to have their parent be set to the camera, then move locally relative to the camera. However when trying to change their position, their position is changed relative to their global position.
The way I am changing the parent is from a script attached to the camera using:
add_child(target_card)
target_card is acquired from a raycast using raycast_result[“collider”]
when trying to change its position I am using:
target_card.set_position(Vector3(0,5,0))
I am using a set position because the camera will move after the card is made a child to it. I just want it to stay 5 units away from the camera.
Using .reparent() worked for its position but when the camera rotates the card isn’t also rotating with it. The rotation is synced when I call reparent but after that, if the camera rotates the card isn’t. If I start the scene with a block already set as a child it will rotate with the camera so that its rotation never changes relative to the camera. Can I also replicate this after using .reparent().
A node will always inherit its parent’s transform (position, rotation, scale, and skew). It your card isn’t rotating with the camera after being parented to the camera, something in your code is affecting it.