OK I have a noob dot product question,
Here is the use case. I am building a space ship builder. You drag parts onto the ship and they attach based on the Normal direction of the mouse collision point of the part of the ship your mouse is on. My problem is that for some parts, I want to set a directional clamp based on X and Y rotation thresholds. For example, engines can only be attaches to other parts where the other part’s normal is within 10 and -10 degrees rotation of the Y rotational axis. (Engine Model Pointing forward)
My first approach was to get the Normal vector, set the Y to zero, and then get the angle between Vector3f.Unit_Z and the resulting normal. Well that does not work if the original normal is 0,1,0 or 0,-1,0 or anything in between.
Can someone help the noob out?
Edit: here is my poor man’s debug statement:
System.err.println(Vector3f.UNIT_Z.angleBetween(event.getCollision().getContactNormal().clone().setY(0)) * FastMath.RAD_TO_DEG + " " + event.getCollision().getContactNormal());