That is correct, I have figured out a way in which to find the exact point in which a point lines within a plane.
Hopefully all of my syntax is right, but this is based upon the surface normal being perpendicular to teh plane, created 2 right triangles with one like side, then using that trigonometric ratios to find the length of the vector to add to the position of the thing, the intersects offset if you will. In addition, this can be optimized by checking to see if VectorDot(GetSurfaceNormal(testsurf), GetThingLVec(testthing)) >= 0 (ie, its either perpendicular to it, or it collides with the back of a thing), if it could possibly collide with that surface. Next you can check the dist3 to an outside variable to see if its the first intersecting surface (ie, its the shortest dist3), if checking all surfaces.
Next, this can be coupled with the point on polygon code by Sige, but I dunno how exactly that code works or if it will always work..... but I can improve upon his sphere thing collision.
This is based upon the fact that the closest an object travels to a given point is when the vector between the point and the object is perpendicular to its direction of motion. This forms a right triangle in which the trigonometric ratios can be used as in the previous setup.
Any questions or comments or amazing insights into finding a simple JK point on polygon that I can figure out or knowledge on how Sige's PoP code works, all the helpful. If anyone needs my 3d drawings/triangles/visuals to help comprehend how this works, just ask. Hopefully I got my syntax and logic right as well...... lol And yes this is untested because its based upon mathematical concepts (which really can't be tested), and I don't have the PoP code to run a true test.
BTW - this topic is also available on JKHub, enjoy.
Code:
vector1 = VectorSub(GetSurfaceCenter(testsurf), GetThingPos(testthing)); // Not normalized vector2 = VectorScale(GetSurfaceNormal(testsurf), -1); // Normalized vector3 = GetThingLVec(testthing); // Normalized dist1 = VectorLen(vector1); cosine1 = VectorDot(VectorNorm(vector1), vector2); dist2 = dist1 * cosine1; cosine2 = VectorDot(vector2, vector3); dist3 = dist2 / cosine2; intersectpos = VectorAdd(GetThingPos(testthing), VectorScale(vector3, dist3));
Hopefully all of my syntax is right, but this is based upon the surface normal being perpendicular to teh plane, created 2 right triangles with one like side, then using that trigonometric ratios to find the length of the vector to add to the position of the thing, the intersects offset if you will. In addition, this can be optimized by checking to see if VectorDot(GetSurfaceNormal(testsurf), GetThingLVec(testthing)) >= 0 (ie, its either perpendicular to it, or it collides with the back of a thing), if it could possibly collide with that surface. Next you can check the dist3 to an outside variable to see if its the first intersecting surface (ie, its the shortest dist3), if checking all surfaces.
Next, this can be coupled with the point on polygon code by Sige, but I dunno how exactly that code works or if it will always work..... but I can improve upon his sphere thing collision.
Code:
vector1 = VectorSub(GetThingPos(point), GetThingPos(testthing)); // Not normalized vector2 = GetThingLVec(testthing); // Normalized dist1 = VectorLen(vector1); sine = VectorLen(VectorCross(VectorNorm(vector1), vector2)); dist2 = dist1*sine; If(dist2 < radius) intersect = 1;
This is based upon the fact that the closest an object travels to a given point is when the vector between the point and the object is perpendicular to its direction of motion. This forms a right triangle in which the trigonometric ratios can be used as in the previous setup.
Any questions or comments or amazing insights into finding a simple JK point on polygon that I can figure out or knowledge on how Sige's PoP code works, all the helpful. If anyone needs my 3d drawings/triangles/visuals to help comprehend how this works, just ask. Hopefully I got my syntax and logic right as well...... lol And yes this is untested because its based upon mathematical concepts (which really can't be tested), and I don't have the PoP code to run a true test.
BTW - this topic is also available on JKHub, enjoy.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack