Development Forum |
|
Different kinds of Position? | |
|
Peppery One
Papriko
|
1/24/2010 | |
Nothing really important, I was just wondering something in C3/DS CAOS:
Where is the difference between the position variables POSL + POST and POSX + POSY?
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
Patient Pirate
ylukyun
Manager
|
1/24/2010 | |
One returns the position of the center of the object, the other returns the position of a bounding box. Since you have left,right,up,down and not just x and y, I think it returns the positions of sides of a square around the object (like a border). But I don't know, as I don't know exactly what a bounding box is. |
Prodigal Sock
Ghosthande
|
1/24/2010 | |
POSL - leftmost edge of object
POST - topmost edge of object
POSX - X position at center
POSY - Y position at center
The bounding box is, AFAIK, simply the sprite itself: all sprites are "boxes" since they are squares, even though parts of them are transparent.
|
Peppery One
Papriko
|
1/24/2010 | |
Aaahh, thats it! Thank you both, I was already wondering what why is where and if and... whatever XD
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |
AquaShee
|
1/24/2010 | |
Actually, bounding boxes are more diamond-shaped rather than rectangular.
The 'corners' of the bounding box are at the middle top, middle bottom, middle left and middle right. You can see this with the 'dcor' CAOS command.
'targ hots dcor 1' should show you the bounding box of any object, and you'll see what I mean.
It's very important to keep this in mind, because this means a tiny object can have a lot of trouble checking if it is touching a much larger object because it has to be quite close to the center of the bottom of the larger object for the bounding boxes to touch.
This also means it's important to make sure any objects with a thin bottom (a spinning top, for example) touches the ground in the very center of it's sprite, or it'll appear to float on slopes.
The Community Scribble: make (y)our own metaroom! |
Gumbo
|
1/30/2010 | |
would POSR be leftmost? would POSB be bottommost?
in the spring you gotta let the flowers fully blossom
|
Prodigal Sock
Ghosthande
|
1/30/2010 | |
Yes, POSB is Bottommost, but POSR is Rightmost. (I assume that's what you meant?)
|