Sega Saturn Development > General Jo Engine Help

SAT / Separating Axis Theorem math: y no werk

<< < (2/2)

ponut64:
Well, I would like to update this thread with a working version of the code.

At least mostly working. There are rounding errors, making some angles of the box not detect but that can be solved! and it actually doesn't crash.
http://www.mediafire.com/file/q782jq8campl0ru/bounder_good.c

As pointed out by XL2, is this good? efficient? Nope. but its a proof of concept for the separating axis theorem, at least.

XL2:
Yeah, don't worry too much about optimization for now.

That being said, if you need a hand to write another collision detection function, don't hesitate to ask and I'll see what I can do.

ponut64:
I am very thankful you are so willing to help.
If when I chop this down to its barest calculations (that I can fathom) and it still may not perform correctly, and I can't think of another way to do it, I'll be sure to ask.

ponut64:
So here's my conclusion to this thread
http://www.mediafire.com/file/do4493rxrmyqk59/bounder_share.c
Instead of full SAT, or a complete RBB, this just calculates the normals of the RBB and uses a dot product comparison between a point projected onto those axis and the dot product of the axis normal vectors themselves. It appears to produce correct results. Technically this is still working on the separating axis theorem, but is much simplified.

The conclusion: separating axis theorem is a working concept, but too complicated in my case.
If someone does need it for jo engine, a sample is in this thread, that is at least somewhat functional. However my warning is that sample includes many mis-labeled axis and so the physics object rotates a different way from the actual object. On top of being very sloppy.

/e: The more I snoop this stuff, the more errors I find... Heh ...

/e: I really must update this thread *one more time*. You see my previous math had so many problems since I had solved for an XYZ system. Well as you know SGL does not seem consistent in any of its axis systems; mesh rotations are in a ZYX system. There is no easy way to "translate" XYZ to ZYX, so I had to fix that. It was actually pretty easy, having spent way too much time on the trig for XYZ. So here is an updated file. It's a single file but the .h files that go with it are included in text (as im sure you can figure out). I hope no one wasted time on any of the code I have shared.
http://www.mediafire.com/file/nbxpemvrh4c1f78/bounder_final.c

Navigation

[0] Message Index

[*] Previous page

Sitemap 1 2 3 4 5 6 7 8 9 10 
Go to full version