Need help with complex shapes

Started by
1 comment, last by spikey82 21 years, 7 months ago
Hi there, I am doing a pinball game (also see other subjects but what bothers me now is my level file format. A pinball machine has different shapes and components: valve, ramp, rebounder etc. How do i describe them naturally? (maths) The goal is also that i must can dynamicely change components, but that is very difficult for a pinball machine. so i need a solid idea. At the moment, i just have a few clues, that''s all. Any ideas are welcome, Greetings from Holland
-I don''t have a signature :p -
Advertisement
Here''s one way I defined shapes:

A shape element can be a line, an arc or a point:
A point is defined by x,y
A line is defined by x,y and an angle
An arc is defined by x,y (the centre), r and the range of angles.

A shape, then, is a circular linked list of these shape elements. This limits you to convex shapes, but there is a way around it. I didn''t have rotation in my game, so I don''t know how easy this would be to arrange.

I have a whole pile of code which does this, and a but more shape related stuff, if you want it, as well as a game which uses it.

I know it sounds complicated, but in the end you have to find something which will work with the way you want to detect and resolve collisions. This way worked for me, although it was largely overkill in my case.
Just some random thoughts...

You might want to define a basic polygon item as AndyMan suggests and then incorporate it into a larger data structure that incorporates other properties like surface elasticity and hardness, what special effects are triggered when that object is struck b the ball, whether the object moves and if so, about what axis and how is it moved!

Cheers,

Timkin

This topic is closed to new replies.

Advertisement