Hello guys, I’m new to GD and I was wondering if someone have a good guide to put a character 2D (sprite art) in a 3D world scene , any guide, course, youtube channel would be of a lot of help.
Sprite3D
inherits from SpriteBase3D
, which has a built-in property for always making the sprite face the camera.
As @TokyoFunkScene says, Sprite3D
is almost certainly what you want here. Actually putting a Sprite2D
in a 3D scene is challenging with Godot, since the engine wants to isolate 2D and 3D scenes from each other. You can overlay one on the other, but they just overlay; one draws on top of the other.
Sprite3D
puts a 2d sprite on a billboard in the 3D scene. There’s also an AnimatedSprite3D
which does what you’d expect. These will interact properly with your 3D scene, including properly obscuring or being obscured by other objects.
I am mixing 2D and 3D in my current game (I have a 3D world but am using 2D TileMapLayers for a ground plane…), and it works because the ground plane is farther away than anything else, but for things that actually interact with the 3D scenery in the game I’m using 3D sprites.
use a Sprite3D or create a meshinstance3D quad mesh and apply a shader converted from standardmaterial with billboard enabled. with a meshinstance3D, it is a good idea to use an instance uniform to control the UV to manually change the sprite frames.
with a sprite3D you can more easily control the sprite frames and even combine it with an AnimationPlayer.
do not, ever, use an animatedsprite3D. AnimatedSprite3D
should only be used for explosions and other particles effects that must play only once. for everything else use an AnimationPlayer. you can use an AnimationPlayer to animate the Sprite3D.
then you need a state machine, the simplest way is to use an AnimationTree. you can control it from variables in your script by using expressions.
an AnimationTree has the advantage of automating a sequence of animations, like idle -> draw_sword -> idle_with_sword -> attack -> holster_sword -> idle
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.