@cybereality said:
I'm not sure how that function works, but it needs distinct vectors. I think this is because a basis must be constructed, and for that to work you need 3 non-parallel vectors. You are passing in 3 parallel vectors, in which case there is no mathematical way to determine what the result would be.
It basically just instances an object in the position of the center of the camera, and rotated in the facing angle of the camera. Is there some way of kinda figuring the angle out by trial and error? I found a way of making decals spawn on surfaces correctly that might be used similarly (passed_results is just the hit point):
func decals(passed_results):
var bullet_instance = bullethole.instance()
bullet_cull.add_child(bullet_instance)
bullet_instance.set_as_toplevel(true)
if passed_results.get("normal").normalized() == Vector3.UP:
bullet_instance.global_transform.origin = passed_results.get("position") + passed_results.get("normal").normalized() * 0.001
bullet_instance.rotation_degrees.x = 90
elif passed_results.get("normal").normalized() == Vector3.DOWN:
bullet_instance.global_transform.origin = passed_results.get("position") + passed_results.get("normal").normalized() * 0.001
bullet_instance.rotation_degrees.x = -90
else:
bullet_instance.look_at_from_position(passed_results.get("position"), passed_results.get("position") + passed_results.get("normal").normalized(), Vector3.UP)
I don't really understand how it works right now, but it fixed some weird facing angle problems i was having with decals and was wondering if it might be a similar issue and could somehow be related?