|
![](/i/fill.gif) |
Hi(gh)!
I re-organized my POVigma project the way that distribution of floor
tiles, non-Oxyd stones (and later on also switches and doors), Oxyd
stones and other items are stored in ASCII "maps", such as:
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,9,6,6,6,6,6,6,6,6,10,1,1,
1,1,1,1,1,1,1,1,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,9,6,10,1,1,1,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,6,6,6,3,1,2,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,6,6,6,4,1,5,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,8,6,7,1,1,1,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,1,1,1,1,1,1,6,6,6,6,6,6,6,6,6,6,1,1,
1,1,1,1,1,1,1,1,8,6,6,6,6,6,6,6,6,7,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
(Layer 1: floor tiles)
with meaning of the numbers as follows:
POVIGMA LEVEL LAYER 1 DOCUMENTATION: FLOOR TILES
Code | Description
| Friction
-----------------------------------------------------------------------------------------------
0 | Black void, ball falls endlessly, life is lost
1 | Grass floor
2 | Grass/Light Grass floor, with Grass in quarter-circle centered
at SW
3 | Grass/Light Grass floor, with Grass in quarter-circle centered
at SE
4 | Grass/Light Grass floor, with Grass in quarter-circle centered
at NE
5 | Grass/Light Grass floor, with Grass in quarter-circle centered
at NW
6 | Light Grass floor
7 | Light Grass/Grass floor, with Light Grass in quarter-circle
centered at SW
8 | Light Grass/Grass floor, with Light Grass in quarter-circle
centered at SE
9 | Light Grass/Grass floor, with Light Grass in quarter-circle
centered at NE
10 | Light Grass/Grass soil, with Light Grass in quarter-circle
centered at NW
(friction to be added later on)
same with stones:
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
(Layer 2: stones, doors, switches)
Code explanation:
POVIGMA LEVEL LAYER 2 DOCUMENTATION: STONES, DOORS, SWITCHES
Code | Description
-----------------------------------------------------------------------------------------------
0 | none
1 | grey marble, brass roof
and with Oxyd stones:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,20,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,21,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
(Layer 3: Oxyd stones)
Code explanation:
POVIGMA LEVEL LAYER 3 DOCUMENTATION: OXYD STONES
Code | Description
-----------------------------------------------------------------------------------------------
0 | none
20 | grey marble, blue white-finned roofs, not hit or covered again
because of mismatch, +0: blue symbol
21 | +1: red symbol
22 | +2: green symbol
23 | +3: yellow symbol
24 | +4: magenta symbol
25 | +5: cyan symbol
26 | +6: white symbol
27 | +7: black symbol
30 | +10: hit, uncovered but not yet matched (blinking question
mark), symbol codes accordingly
40 | +20: hit, uncovered and matched, symbol codes accordingly
These "maps" are read from disk when parsing each frame and, if any
changes occur, are written back to disk afterwards.
Furthermore, the current direction of the ball's movement (degrees), its
speed (POV units/frame) and the clock value at the last change of these
two values are also stored in an ASCII file.
The rendering of the static scene works fine, but...
...I obviously just can't get right the logic conditions for collision
detection!
Here is what I cooked up until now:
#declare rows=0; // check for collision with any stone
#while (rows < LevelLength)
#declare cols=0;
#while (cols < LevelWidth)
#warning concat("row: ", str(rows, 1, 0), ", col: ", str (cols, 1, 0))
#if (layer2_array[rows][cols] = 1 | layer3_array[rows][cols] >= 20)
#declare xmin=cols-0.35;
#declare xmax=cols+1+0.35;
#declare zmin=rows-0.35;
#declare zmax=rows+1+0.35;
#if (ballpos_next.x > xmin & ballpos_next.x < xmax &
ballpos_next.z > zmin & ballpos_next.z < zmax)
#declare dir = 360-dir;
#declare hit=1;
#break
#end
/* #if ( < zmax & (ballpos.x <= xmin | ballpos.x >= xmax))
#declare dir = 180-dir;
#declare hit=1;
#break
#end */
#end
#declare cols=cols+1;
#end
#if (hit)
#break
#end
#declare rows=rows+1;
#end
Each stone (Oxyd or non-Oxyd) essentially is a box of 1 by 1 by 1 units
defined with its lower left front corner at the origin.
Attached is the basic layout of the scene (lower left corner: <0, 0, 0>,
upper right corner: <20, 1, 13>), and when I start animating the ball at
a speed of 0.1 and starting angle of 60 degrees, first all goes fine,
the ball is reflected from the northwestern Oxyd stone (those with the
blue pyramidal roofs) and then heads towards the northern stone wall -
but shortly before it hits, a strange thing happens: the ball starts
moving parallel to the z axis and goes right through the wall rather
than being reflected!
What did I wrong? Do I have to post all include files such as pigments,
finishes, textures and objects for you to understand (and perhaps solve)
my problem?
See you in Khyberspace!
Yadgar
Post a reply to this message
Attachments:
Download '2015-08-27 povigma level 1, take 7.jpg' (193 KB)
Preview of image '2015-08-27 povigma level 1, take 7.jpg'
![2015-08-27 povigma level 1, take 7.jpg](/povray.binaries.animations/attachment/%3C55df68d1%40news.povray.org%3E/2015-08-27%20povigma%20level%201%2C%20take%207.jpg?ttop=441773&toff=100&preview=1)
|
![](/i/fill.gif) |