FreshRSS

Zobrazení pro čtení

Jsou dostupné nové články, klikněte pro obnovení stránky.

How to match Sprite3D's collision poly to its billboard transform?

Assume there is a Sprite3D with a Y- billboard flag on. This sprite3D has a matching CollisionPolygon3D Collision polygon3D is set up to "look" at the camera with a look_at() function, similar to the Y-billboard.

However, the collision poly and the sprite3D do not match at non-orthogonal angles:

Angle to camera is about 45deg

(Angle to the camera is about 45deg)

I understand that Y-billboard flag achieves the "look at the camera" effect with a shader, while look_at() is a spacial matrix transform. Yet, is there a way to align these two?

How to prevent Sprite3D from clipping into nearby objects?

Gotot 4.2

Sprite3D is very useful for representing 2D objects within the gameworld. However, when billboarded (Y-billboard), 3D Sprites are prone to clipping into the floor/walls/other 3D models they are close to.

enter image description here

There is an easy way to "force" the sprite3D to be drawn in front of the cube by checking "No depth test" in the sprite 3D's flags, but that makes the sprite visible through all walls/floor.

The other method I tried is to manipulation of the sprite3D's and Cube's material transparency settings:

3D Cube's and Floor's material:

        Transparency: Alpha
        Blend Mode: Mix
        Cull Mode: Disabled
        Depth Draw: Always
        No Depth Test: unticked

This solves the "see-through walls" problem and prevents clipping through the cube, but the sprite3D is still visible through the floor.

Is there some other way to prevent this clipping? Maybe to have the sprite's depth (or "render order") depend on its origin?

How to prevent the "_ready" events and pre-ready var declarations in a loaded, instantiated scene?

I have a simple save game/load game system that packs the entire world scene to the disk, then loads it via ResourceLoader.load():

var loadedGame = ResourceLoader.load(SAVEGAME_PATH,"",ResourceLoader.CACHE_MODE_IGNORE).instantiate()

It works fine, and the game state is somewhat successfully saved/restored. The problem is that upon loading the game (i.e. instantiating the loaded scene) all _ready events on ALL the nodes inside it are fired off again and all variables that were declared pre-ready are re-declared (i.e. revert to the original values).

Is there a way to suppress these _ready events and re-declarations in this specific use case?

❌