C++ aabb-triangle collision Created 1 year ago2022-08-14 12:18:08 UTC by Meerjel01 Meerjel01

Created 1 year ago2022-08-14 12:18:08 UTC by Meerjel01 Meerjel01

Posted 1 year ago2022-08-14 12:18:08 UTC Post #346781
This was an issue for me to figure out how to make an aabb (obb) collide with triangles on my Xbox engine and since people can C++ here, I'll ask here.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-18 13:34:17 UTC Post #346799
I've found this to be pretty useful:
https://gdbooks.gitbooks.io/3dcollisions/content/Chapter4/aabb-triangle.html
It has lots of other intersection algorithms too, like AABB vs. sphere, or AABB vs. plane which is useful for frustum culling.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2022-08-18 15:24:29 UTC Post #346800
I've found that one before but it doesn't look like C++ programming. But it's convertible at least.

Has a bit of a "Too Long Didn't Read" problem with instructions like that. But I can look this through.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-22 09:26:34 UTC Post #346805
Having some problems getting my levels to load on the hardware currently so I wasn't able to program any collision code yet. In the mean time someone can translate the code to C++ for me. If someone wants to convert it. Currently the problem to understand about it is the SAT sections.

EDIT:
Got the engine to load levels again somehow and will work on collision detection next.

This is the level that I'm gonna use. (Straight from the Console itself)
User posted image
EDIT2:
Having trouble getting through this line.
{ if (Max(-Max(p0, p1, p2), Min(p0, p1, p2)) > r) }
Anyone with a 3 parameter function for this?
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-23 18:41:32 UTC Post #346806
I tested the code and I think my only problem is the AABB system that I'm using. Anyone willing to help?
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-25 14:06:30 UTC Post #346809
Achievement! I got it working! Now I need to make the AABB object oriented and make the player slide on collision (There's a function in the Xbox Home-brew website to make collision reaction).

Thanks for clarifying me about that site Admer. I don't think I ever got this far with engine making with DX8.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-27 12:37:00 UTC Post #346815
I've found this But it's not constructed like the code I have. If someone knows how to help then do that please.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-28 10:08:41 UTC Post #346818
I got it working myself! Now the player can collide and slide on a triangle!

1 triangle. When going to a corner the player goes through another. Will get to work on fixing that. Also I switched to a sphere collider and will try to implement a capsule collider later on.

EDIT:
Got it working myself again.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-08-30 14:55:47 UTC Post #346824
Had been talking to Admer about slopes and got it working. Now I need to work on step-offset for stairs and Capsule colliders. I had looked up This when I struggled with collision detection and it might be a good source for information right now.

Here's some screenshots from in-engine. (If anyone's still interested)
User posted image
User posted image
User posted image
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-09-03 14:04:45 UTC Post #346845
Couldn't make step-offset work but I will try make OBBs work. I will relay on invisible colliders for stairs and small edges for now until I get it working.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-10-31 11:02:04 UTC Post #347032
Bump*

I've made a stair climbing system for the engine though it isn't as good as I wanted it to be. But I've come up with a fix for the raycast method.
User posted image
Also this is the ray-triangle code that I used.

EDIT:
Credit to Admer for giving me some code to work with.
Meerjel01 Meerjel01I want to be a Meerjel
Posted 1 year ago2022-11-07 20:48:52 UTC Post #347056
Messed with the code and got it to stop working so I decided to go with separated collision triangles instead.

It wasn't a complex engine anyway so it works fine.

EDIT:
Made the link a Vimeo link.
Meerjel01 Meerjel01I want to be a Meerjel
You must be logged in to post a response.