How to Align a Node3D to a PhysicsBody3D's normal?

Godot Version

4.6.2

Question

Ok so I’m trying to create something that takes a Node3D and aligns it to the normal of a PhysicsBody3D. For Clarity sake, when I say “align to normal”, what I mean is: if I point the Node3D at a vertical wall, I want the Node3D to rotate 90 degrees so that it is perpendicular with the wall.

I do have access to the PhysicsBody3D’s normal and I figure I’m supposed to use the look_at() function here. but I’m sure how. if anyone would mind helping me with that would be greatly appreciated.

i think you better use a marker 3D and physic functions

put this marker up your physicbody3D ; and tell this :

func _physics_process (delta) -> void :
    Node3D.position = marker2D.position

easy ways work :moai:

or you can use this also :

func _physics_process (delta) -> void :
    Node3D.position = position + Vector3(0,0,10) #10 for example

I already figured out how to move the Node3D’s position. I need help with rotating the Node3D so it aligns with the surface’s normal.

i think my example is still valid , just like this i guess

func _physics_process (delta) -> void :
    Node3D.position = position + Vector3(0,0,10) #10 for example
    Node3D.look_at(position)
# and then , if you rotate the pysical body node , the Node3D will turn aroud it like a planet idk
    rotate(PI/180)