We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

GDL-Object always looking to camera

Anonymous
Not applicable
Hi,

I want my (Bitmap)GDL-object always to look into the camera. I know I can Use GLOB_EYEPOS_X or _Y or _Z. But how do I do that? I don't find it in the manual...

thanks a lot

Macangelo
7 REPLIES 7
Frank Beister
Moderator
I don't have the code by the hand, but you should find it in the gdl cookbook or by search in this forum.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
macangelo wrote:
Hi,

I want my (Bitmap)GDL-object always to look into the camera. I know I can Use GLOB_EYEPOS_X or _Y or _Z. But how do I do that? I don't find it in the manual...

thanks a lot

Macangelo
Macangelo,
Here's part of one of my scripts that rotate. I developed it so long ago, I don't really remember how to explain it...I think I go the concept from DNC.

anyway, here it is:

dkx=K~-X~:if dkx=0 then dkx=1
dly=L~-Y~:if dly=0 then dly=1
dazi=ATN(dly/dkx)

if (dazi+90) >90 then rotz 180
if (dazi+90) <90 then rotz 0

HTH,
dan K
Anonymous
Not applicable
Hi Dan,

Thanks for your try.

I copied and pasted your code and get the error message:
"Die Verwendung von realen Typen kann zu Präzisionsproblemen führen." meaning something like "The usage of real types can lead to precision problems." or something 😉

I replaced K~ with GLOB_EYEPOS_X and L~ with GLOB_EYEPOS_Y - same result.

And it does not turn my object.

Any ideas?

Thanks a lot and have wonderful day

Macangelo
Anonymous
Not applicable
macangelo wrote:
Hi Dan,

I copied and pasted your code and get the error message:
"Die Verwendung von realen Typen kann zu Präzisionsproblemen führen." meaning something like "The usage of real types can lead to precision problems." or something 😉

I replaced K~ with GLOB_EYEPOS_X and L~ with GLOB_EYEPOS_Y - same result.

...Macangelo
You can ignore the "The usage of real types can lead to precision problems" message.

Sometimes you need to rebuild the window for the object to turn.

The older K~ and L~ global variables should still work. If you still cant get it to work post your full 3d script here for us to see and comment.

Dan K
Anonymous
Not applicable
Macangelo,
Try this ... I know it works... just remember that you will probably need to do a "rebuild and regenerate" to see the rotation.

P.S. note that it even works correctly if the symbol is mirrored!

2d Script:
project2 2,270,1

3d Script:
dkx=K~-X~:if dkx=0 then dkx=1
dly=L~-Y~:if dly=0 then dly=1
dazi=ATN(dly/dkx)

if (dazi+90) >90 then rotz 180
if (dazi+90) <90 then rotz 0

if SYMB_MIRRORED goto 20
rotz 90+dazi-W~
goto 30

20:
rotz -90-dazi+W~

30:
ADDX -A/2

block a,1',1'
Anonymous
Not applicable
Hi Dan,

thanks for the offer. Here's my full code. I try your new code as soon as I'm back at my desk.

Best
Macangelo

SHADOW on

dkx=GLOB_EYEPOS_X-X~:if dkx=0 then dkx=1
dly=GLOB_EYEPOS_Y-Y~:if dly=0 then dly=1
dazi=ATN(dly/dkx)

if (dazi+90) >90 then rotz 180
if (dazi+90) <90 then rotz 0

rotx 90



B=199*ZZYZX/480
ADDX -B/2

PICTURE "PEOPLE10.TIF", B, ZZYZX, 1
Anonymous
Not applicable
Hi Dan,

Many, many thanks - it works!

Have a wonderful day

Macangelo