saluk / PyWright-godot

An implementation of the PyWright Casemaker in the Godot engine
6 stars 2 forks source link

Render sprites in 3d so we can do 3d rotations #15

Open saluk opened 1 year ago

saluk commented 1 year ago

This kind of big change would require the use of viewports to render AnimatedSprite3D as our base object rather than just AnimatedSprites. It would enable us to do some cool 3d effects such as rotating buttons in and out of perspective as on the DS.

Old: WrightObject -> Node2D WrightObject.current_sprite -> PWSprite PWSprite -> Node2D PWSprite.animated_sprite -> AnimatedSprite

New: WrightObject -> Node2D WrightObject.current_sprite -> PWSprite3D PWSprite3D -> ViewportContainer PWSprite3D.viewport -> Viewport PWSprite3D.viewport.spatial_root -> Spatial PWSprite3D.viewport.spatial_root.camera -> Camera PWSprite3D.viewport.spatial_root.animated_sprite -> AnimatedSprite3D

Some care needs to be taken to get the pixel scaling in the perspective camera correct so that at no rotation, sprites appear the same size.

Performance may be a consideration, we may want to keep old PWSprites around for objects that aren't being rotated, and only use the 3D version during a 3d animation,

saluk commented 3 weeks ago

We have Node3D now (built for 3d examine) that may be used for this purpose. Or we may want to create our own related system for it to keep complexity down.