0 votes

Hi buddies

thank you for your help in advance
func process(delta: float) -> void:
var camera
pos = getviewport().getcamera().globaltransform.origin
camera
pos.y = 0
lookat(camerapos, Vector3.UP)
pass

I used this code for my flat plane in Godot v3.3.4, its working but it has an issue, the problem is when I get close to the sprite on 3D view , my plain rotate in x or z axis,in other word flat sprite will band towards the camera (its because origin of the sprite is facing to the camera on the character head)
another issue is what if I have more than one camera on the scene!
so in this case "Look_at" will chose which one?

About billboard method , its working but it has another issue which is when I`m going behind the flat plain my artwork (sprite) gonna flip or upside down.

I think the solution is, put a 3D position in foot of character and link "look_at" to that point instead of camera on the head.what you guys think?
but how can I find that 3D position on player scene from other sprite scene!?

Godot version v3.3.4
in Engine by

1 Answer

0 votes

You probably need to set Flags > Billboard to Y-Billboard at your Sprite3D node. This way, it should always face active camera, no matter how many of them you have.

by (1,462 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.