Weird error relating to look_at()

If someone has a solution, please tell me

Are you shooting the floor?

1 Like

Yes, the error only occurs when I shoot the floor, haven’t tested ceilings.

I think, and I am not particularly experienced in 3D, it is because you are asking something that is already pointing up to look at something that makes it point up.

Just move it to after your if statement directly below. If it is already pointing in the normal direction, no need for the look_at.

If I am totally off the mark, apologies in advance.

1 Like

look_at doesn’t work when the direction to the target is parallel with the normal, you need to check for this case, using something like is_equal_approx(abs(direction.dot(normal)), 1), assuming the direction vector is normalized

1 Like

I think you are 100% right, I’m just not sure how to fix it. I’m gonna try the other guys answer.
Thank you for the reply!

This works, and if anyone needs an example:
Edit: It doesnt work when it comes to shooting walls, I think it has something to do with global transforms becuse it works on the Z axis but blurs on the X axis.
This blurring is solved by the code being put under the approx if statment.

1 Like

Sorry for replying again!
But apparently the bullet holes blur on the X axis, which is what the code below the approx. if statement is trying to solve, do you have a solution.