Godot Version
3.5.1 Snap Store, Ubuntu OS 22.4
For the past weeks I’ve been searching for ways to make my NPCs 2D sprites in a 3D scene, so they look like DOOM enemies (So they have different angles depending on where you look at them), but I can’t find any detailed or complete tutorial that can teach me how to do it and I’m kinda new.
Any tutorial/link/project will be helpful
Hello there,
if I remember correctly the old sprites (or models) were made in clay oder something, so im pretty sure this is no option for you.
Its been a loong time since I played doom.
Search for old making of doom videos.
My Try in a modern enviroment would be :
Take a 3d model and create a picture from each angle.
Scale it down in photoshop or any other art program (to pixelize it)
Put the picture on a 3d plane and make a plane for each direction
I dont see any reason why this should not work.
This probably not the answer you are looking for. But maybe this helps a little bit.
It’s been a while since I last played doom so I’m not sure how the character look but there is a Sprite3D
node in Godot that allows you to place 2D sprites in a 3D scene. Enabling the Billboard
option on these nodes will have the sprite always facing cameras.
From there, I would divide the space relative to the enemy in four parts:
Which represent which sprite must be drawn depending on where the camera is relative to the enemy.
Then I would in each process
call calculate the angle between:
- the vector pointing from the enemy to the camera (which I think is something like
camera.global_position - enemy.global_position
),
- the
-z
axis (forward direction) of the enemy’s local basis (can be access with something like -enemy.transform.basis.z
I believe),
in the (x, z)
plane (the vectors have to be 2D).
(I think the angle between two vectors can be obtained with vec1.angle_to(vec2)
or something similar)
Once that is done, if the absolute value of the angle is between 0 and pi/3 then you have to display the front sprite, if it’s between pi/3 and 2pi/3 then it’s the side sprite, 2pi/3 and pi is the back sprite.
Let me know if this is helpful
3 Likes