General Category > General Anim8or Forum
WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
cooldude234:
I just tested your code, it doesn't work. It apparently has a collision really messed up, it seems to have collision in a random place on the plane, and the collision spot is smaller than the actual triangle.
I'll do some more debugging.
Thanos:
--- Quote from: cooldude234 on February 28, 2013, 09:23:55 pm ---I just tested your code, it doesn't work.
--- End quote ---
DOH. :-/
Did you also test the code I sent you in the PM and it still doesn't work?
--- Quote from: cooldude234 on February 28, 2013, 04:40:50 pm ---Also what method are you using (I really don't understand any the code too much), is it this method you are using?
http://geomalgorithms.com/a06-_intersect-2.html
--- End quote ---
Nope, the method I use is based on solving linear systems of equations. I might upload some explanation later.
--- Quote from: cooldude234 on February 28, 2013, 04:40:50 pm ---Right now I'm trying to figure out how a, b and c are being represented as the plane, because the math that you used to make the plane defined by the triangle is exactly the same as the code I used for finding the normal of the triangle (by getting the cross-product). But you cannot have a plane with the normal, you need a point as well to define the position (I use the first vertices read because its quick and easy, it doesn't matter which it is anyways).
--- End quote ---
You forgot 'd'. (a,b,c) is indeed the normal of the plane. But, a*x+b*y+c*z=d is what describes the actual plane. I put it in a linear system with the other equations (lines etc) and new results are produced. The assignments I do (abcd,a1a2 etc) are actually the solutions of the linear systems.
No, of course I didn't solve them myself. get wxMaxima from here: http://sourceforge.net/projects/wxmaxima
The code for finding the collision point is correct, I've tested it many times. Now, what happens with the code for checking if it belongs in the triangle... that's another weird problem.
EDIT: wait, what do you mean 'the collision spot is smaller than the actual triangle'?
cooldude234:
The code you sent the pm was exactly the same as the one you sent in the post and d is never used for testing if the point is inside the triangle.
--- Quote from: Thanos on March 01, 2013, 07:43:21 am ---The code for finding the collision point is correct, I've tested it many times. Now, what happens with the code for checking if it belongs in the triangle... that's another weird problem.
EDIT: wait, what do you mean 'the collision spot is smaller than the actual triangle'?
--- End quote ---
Yea the issue I'm having isn't finding the collision point, but just whether it lies inside the triangle or not.
Also what I mean by the collision spot is, the area of collision (the area where you can collide with the object) doesn't match up with the triangle it's self (previously it was close, it just didn't match near the vertices), here no matter what it appears to be flipped on the x (or maybe z axis, maybe both?) and is about a third of the triangles size.
EDIT: I may have fixed it. I took out some code that probably was scaling it out of proportions, and I also fixed it's flipped axis once again (it also had to do with that weird code). It seems to be working, but just a little minor thing. I have two vertices joined together, and I keep falling between them at where their joined. I thought checking if greater or equal to was supposed to check if its on the edge as well?
EDIT: there seems to be some issues when I put it into an object, I not sure whats happening so I'll do some more debugging, but it doesn't seem to be working again ):
Thanos:
--- Quote from: cooldude234 on March 01, 2013, 02:59:32 pm ---d is never used for testing if the point is inside the triangle.
--- End quote ---
Oh yes, for testing if the point belongs in the triangle I didn't use d, but the plane's normal plus a vertice that belongs in the plane (Vert1/2/3).
--- Quote from: cooldude234 on March 01, 2013, 02:59:32 pm ---EDIT: there seems to be some issues when I put it into an object, I not sure whats happening so I'll do some more debugging, but it doesn't seem to be working again ):
--- End quote ---
): I'll test it again too... but I've failed so many times that I'm not anymore sure if I'll do anything useful...
cre8orexpert:
Don't give up Thanos, one day you will be playing a game made by dude's engine, see a awesome collision, and think "hey that's my code!", while mankind is being annihilated by an alien spaceship from sector XD-123 and cooldude234 is happily laughing at how much he sold earth for. Hey robert, are you working in something else, other than physics and sound?
PS: I need to stop drinking so much coffee.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version