Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Point to 3D Triangle Collision
- Elijah999999
-
Scratcher
1000+ posts
Point to 3D Triangle Collision
Say I have these variables:
Is it possible to use these variables to detect whether or not the player has collided with the triangle?
I understand this: I need to define an infinite plane using the triangle, and then project the player's position onto that plane so I that I can do use a 2D collision detection algorithm. I found a tutorial on Google on the 2D algorithm part, so that part I don't need help with. But I don't understand how to create the plane or project anything on to it.
(Player X)
(Player Y)
(Player Z) // Defines the Player's Position
(Triangle X1)
(Triangle Y1)
(Triangle Z1) // Defines the first point of the triangle
(Triangle X2)
(Triangle Y2)
(Triangle Z2) // Defines the second point of the triangle
(Triangle X3)
(Triangle Y3)
(Triangle Z3) // etc.
Is it possible to use these variables to detect whether or not the player has collided with the triangle?
I understand this: I need to define an infinite plane using the triangle, and then project the player's position onto that plane so I that I can do use a 2D collision detection algorithm. I found a tutorial on Google on the 2D algorithm part, so that part I don't need help with. But I don't understand how to create the plane or project anything on to it.
Last edited by Elijah999999 (July 27, 2025 00:31:56)
- N8_D_GR8_1
-
Scratcher
1000+ posts
Point to 3D Triangle Collision
I made a demo using Desmos. If you have prebaked normals, than I would use those instead of recalculating them.
https://www.desmos.com/3d/j4nvamznmp
Let me know if that helps
https://www.desmos.com/3d/j4nvamznmp
Let me know if that helps

- Elijah999999
-
Scratcher
1000+ posts
Point to 3D Triangle Collision
I made a demo using Desmos. If you have prebaked normals, than I would use those instead of recalculating them.Thanks for your help! I'm afraid that I wasn't clear enough about what I already understood. I accidentally worded it to imply that I know how to project the points onto the plane, but the problem is… I don't. Would you or someone else mind explaining that to me as well?
https://www.desmos.com/3d/j4nvamznmp
Let me know if that helps
Either way, I appreciate your help.
- ispretty
-
Scratcher
500+ posts
Point to 3D Triangle Collision
You can first find the vector from a point on the plane to the player's position, and then project that vector onto the normal, and then finally subtract that vector from the player's position to project the player's point onto the plane.I made a demo using Desmos. If you have prebaked normals, than I would use those instead of recalculating them.Thanks for your help! I'm afraid that I wasn't clear enough about what I already understood. I accidentally worded it to imply that I know how to project the points onto the plane, but the problem is… I don't. Would you or someone else mind explaining that to me as well?
https://www.desmos.com/3d/j4nvamznmp
Let me know if that helps
Either way, I appreciate your help.
Last edited by ispretty (July 27, 2025 04:11:34)
- Discussion Forums
- » Help with Scripts
-
» Point to 3D Triangle Collision