• General Chat
  • How to prevent a child node from inheriting it's parent's rotation?

i am making a rigid body with a life bar as a child, the life bar follows and bounces with its parent which is a behavior i want , but when the rigid body rotates the life bar also rotates and makes observing it very hard . is there a way to stop a child node from inheriting it's parent's rotation and only the rotation?

func _process():
	transform = get_parent().transform.inverse()
	transform.origin += get_parent().origin
	#(not tested, just off the top of my head)
	#Or maybe...
	transform.basis = Basis.IDENTITY

thanks for replying , it did not work , but you gave me a hint :)

var parent_rotation 


func _process(delta):
	parent_rotation = get_parent().rotation
	set_rotation(- parent_rotation)

by just setting the life bar rotation to negative rotation of it's parent it will remain still . thanks for the hint <3