Game Development Community


#1
03/04/2005 (11:50 am)
@Rob: Is there any chance you could post or send me an image of what you're trying to achieve because this sounds like alot of work that T2D could do for you and I've not got that much time so a picture would help to get straight to your problem.

BTW: You can use "mFloor" and "mCeil" to round float values down and up respectively.

- Melv.
#2
03/04/2005 (12:06 pm)
That's what's confusing me. Ball = circular? 8 corners?

- Melv.
#3
03/04/2005 (12:36 pm)
Sounds like he has his balls alligned in an octaganol pattern. So each ball could be surrounded by 8 balls. On the collision he's wanting to know which one of the 8 octaganol sides his ball hit to know where to stick it.
#4
03/04/2005 (4:29 pm)
Robert, many ways to solve this one, and you don't even need to mess with math. One simple way, since you want a regular grid of balls, is just to enforce regularity. Essentially, you have a row / colum system set-up there. When a moving ball collides w/ a static one, just look at the moving ball's center point. It can only fall within one "bin" (row, column pair). See which one and set the ball's new position to the center of that column.

That's a quick and easy way :) If you want to do math though, there's also many different ways to calculate it. I assume you just want a solution to this problem though, not a TorqueScript math tutorial. Let me / us know though if I'm wrong. :)
#5
03/05/2005 (10:26 am)
Robert, that'll work. That's roughly what I was talking about too, all you need is a few comparisons (left, right, top, middle, bottom) and you're there. It's easy to code and executes very quickly this way (not that performance is going to be a real constraint in this game), so it's a better solution than using trigonomics. Good job. :)