General Category > General Anim8or Forum
WEEHEEEE oh, oh wait its dead, I thought it was dancing (CRE8OR NOTICE)
Thanos:
It works perfectly. Makes no sense. Are you sure the error is in the line - triangle collision code?
I remember writing some code for 2d collision back then... the problem wasn't in the collision detection method, but in the code that was using it. I mean, maybe it's not a matter of how you find the collision, but what you do afterwards.
cooldude234:
AH HA, I figured out why certain triangles worked, and other did not
Apparently certain sizes and angles in certain locations just don't work at all.
Now beyond that I have no clue why that is.
EDIT: did some more testing, and quite literally this is the opposite of floating point in inaccuracies, it's literally just the size of the triangle that causes issues
cooldude234:
Long time no screens :P
So I've somewhat gotten polygonal distribution (this is what I'm calling it, there's not really any name for it) working. I can distribute objects onto a polygon of any size at any angle, however it doesn't want to stay inside of the triangle (so I guess I still have some bugs to work out).
It does run decently fast (and there's a lot of things I did which slowed it down, meaning there's lots of room for optimization).
I can distribute a 1000 random objects and have the engine run at about 20 - 30 frames a second. Distributing 200 objects was around 80 - 95 frames, and it probably would have ran much faster if I didn't render the object (I could also optimized the way they're being rendered to speed it up).
So here's the screens,
cooldude234:
I fixed it a bit... err maybe?
It seems to work, except the one corner has more of a probability to have objects near it than others. I believe this has to do something with the scalar value I am using in my algorithm. But non the less it is a much better result than previous attempts.
EDIT: getting 130 - 150 frames a second, whilst calculating 250 random positions on the triangle every frame
cooldude234:
okay so maybe I don't really know whats going on beyond the code.
I replaced the distance variable (which is supposed to define the size of the triangle and later be used for picking a random point inside that) with a value of 10.
This is what happen.
I think I'll look over everything again :P
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version