Saturday, February 20, 2010

Octagonal Spawning Area

I have an octagonal area for the UFC Undisputed PS3 Homespace. In this area i need to spawn balls that will fall from the sky (it's for a minigame of sorts). We are currently spwning the balls based upong the center and then a radius from that. Simple enough. But i was intrigued to know if there was a simply algorythm that could spawn the balls correctly in this shape. After all the shape is a nice one.

so i put it out on Twitter to see if anyone had any ideas. so far i have had two great replies.

ClingerManGW suggested
Spawn into a circle that contains the octagon Check collisions for each side of octagon (use rectangles). If collision respawn

tomatoGG suggested
always tot of an octagon as a square with 4 triangles lobbed off. filter out spawn point if in triangles? simple but not fast.

Both great replies. I am not sure if we will do these as we have to write in LUA for PS3 Home, so it's not fast at all.

Thanks for the help.
laters

No comments:

Post a Comment