Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 09 October 2012 - 01:07 AM
Posted 09 October 2012 - 07:45 AM
P' = M x P |a b c d| |x| P' = |e f g h| * |y| |i j k l| |z| |m n o p| P'x = ax+by+cz+d P'y = ix+jy+kz+l P'z = mx+ny+oz+p
Enclosing points (8): a, b, c, d, e, f, g, h Interpolants generated per point: Ps, Pt, Pu Lerp(t, P1, P2)=P1+t*(P2-P1) P' = Lerp(Pu, Lerp(Ps, Lerp(Pt, A, B), Lerp(Pt, C, D) ), Lerp(Ps, Lerp(Pt, E, F), Lerp(Pt, G, H))) P' = (((a+s*(b-a))+t*((c+s*(d-c))-(a+s*(b-a))))+u*(((e+s*(f-e))+t*((g+s*(h-g))-(e+s*(f-e))))-((a+s*(b-a))+t*((c+s*(d-c))-(a+s*(b-a)))))) P' = Ps*(b-a) + Pt*(c-a) + Pu*(e-a) + Ps*Pt*(d-c-b+a) + Ps*Pu*(f-e-b+a) + Pt*Pu*(g-e-c+a) + Ps*Pt*Pu*(h-g-f+e-d+c+b-a) simplify out the coefficients: P' = Ps*(A) + Pt*(B) + Pu*(C) + Ps*Pt*(D) + Ps*Pu*(E) + Pt*Pu*(F) + Ps*Pt*Pu*(G)
Edited by JTippetts, 09 October 2012 - 07:48 AM.
Posted 09 October 2012 - 08:07 AM
Edited by FLeBlanc, 09 October 2012 - 08:12 AM.
Posted 09 October 2012 - 03:33 PM
tranformedMesh = transform(mesh, object.worldMatrix) if ray.intersects(tranformedMesh) \\collisionDo this
transformedRay = transform(ray, object.worldMatrix.inverse) if transformedRay.intersects(mesh) \\collisionthis way you only have to transform a ray that consists of two vectors instead of all of the mesh data
Edited by HappyCoder, 09 October 2012 - 03:36 PM.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.