Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

True billboarding?

A topic by Lucas H枚rand created Mar 17, 2021 Views: 276 Replies: 1
Viewing posts 1 to 3
(1 edit) (+1)

Yo!

I'm amazed by Fauxton. It's well-written, complete and, most importantly, super cool.

I've been fiddling with it a little bit, I tried to invoke the demons of mathematics but cannot find an elegant solution. I'll keep trying, but maybe it's something that the lib could benefit in some kind of update, it seems to the kind of feature that we expect from a 2.5d lib.

The billboarding (the fact that the player always faces the camera) works fine, but it's still impacted by the "height" of the camera... 

Taking the provided example to illustrate, if you move the camera to the very top of your scene, as if you were viewing the scene from the top, the player sprite disappear - of course, he's a 2D flat guy :). Do you have any clue of what to do to make the player fully facing the camera and not being affected by camera's position?

Again, congrats for your work!

Developer (2 edits)

Thank you for the kind words! So it actually does support true billboarding (100% camera facing). Try this! 馃槈

DrawSprite3D(sprite_index, image_index, x, y, z, -CAMERA_PITCH, 0, -CAMERA_ANGLE, image_xscale, image_yscale, image_zscale, image_blend, image_alpha);

You just have to account for the 'camera pitch' when rotating the sprite! Be aware that you can potentially get clipping issues since if you imagine not looking from the camera's perspective you are rotating the sprite around the xyz axis. if 'z=0' then once you look over the top he will more than likely disappear into the ground. :P