java - add length to a line that passes through 2 points and get the new end point -
I am working with lwjgl and j3d for the geometry section. I am still working on the collision, whatever I have done so far, the collision is working properly but there are two problems in it, adding to my current collision method, it tests that if the previous coordination and current coordinate triangle (Which is provided to things) and then on the triangle it finds that it is only intersected that is near your current coordination and you go there. It also makes your Y coordination .001. It's a workd offspring, but going up .001 is bad because if you go to a triangle which is going to 90 * angle, then you can go to the left, but you can not take it out, Almost as you are stuck in it. Here is a picture how it works imgur
I would like to say .001 Current coordination and the closest point (I already get these points) and get the new current point .
BTW is Pew, where the person was before moving on point and then tests to see if those two points penetrate the triangle and then I get the nearest point if it happens So it is that the picture is defined as the closest. I can already calculate all of those points
If I think you are right then you Want to get away from the triangle from001. If this is the case then you need a triangle vector vector of 0.001. In the case of a triangle it is usually called "normal" if you already have a normal triangle, then multiply that by .001 and add that if you do not have a general then you can calculate it using cross product. (Details of what you have a cross-product to Google), something like this, from the corner of a triangle:
vector 3 vertical = crossproduct (vertex 3.spo - vertex 1.po, vertex 2.Po - Vertex 1.Po); Vector 3 normal = perpendicular / length (normal); Vector 3 offset = normal * 0.001f;
Comments
Post a Comment