Pixies

Blitz3D Forums/Blitz3D Programming/Pixies

JoeGr(Posted 2006) [#1]
I wonder if somebody could explain to me how Skidracer's excellent 'Pixies' code works. After much puzzling I still can't understand what is going on with it, especially this bit:
magic=CreatePivot(camera) 
NameEntity(magic,"pixiespace")
aspect#=Float(viewheight)/viewwidth
PositionEntity magic,-1,aspect,1 
scale#=2.0/viewwidth 
ScaleEntity magic,scale,-scale,-scale 
magic=CreatePivot(magic)
PositionEntity magic,-.5,-.5,0

and especially especially the line:
magic=CreatePivot(magic)

Any help would be much appreciated.

Full code here:
http://www.blitzbasic.com/codearcs/codearcs.php?code=773


Rroff(Posted 2006) [#2]
as magic was previously used for:

magic=CreatePivot(camera)

which creates a pivot parented to the camera entity... when he then uses

magic=CreatePivot(magic)

it creates a second pivot with the first pivot as its parent...

notice that he uses

NameEntity(magic,"pixiespace")

so that he can find the first pivot again

not a great fan of this method of coding myself.


JoeGr(Posted 2006) [#3]
Ah. Thanks. So he's just reusing the handle instead of creating a new one for the second pivot? I thought there might be something clever going on there which I didn't understand. You're right, that does seem like a slightly odd way to code. Still, it works.

What about the rest? How does all the positioning and scaling stuff work?