![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | jackash |
I was trying to do something that was widely used in older games when trees were just plane meshes with sprites attached to them. Meshes then rotated to always face the camera, you may remember that.
And now I need it to display text in 3d world. I wrote this short script for that purpose and attached it to an object:
func _process(delta):
var point = camera.global_transform.origin
plane.look_at(Vector3(point.x, plane.transform.y, point.z), Vector3.DOWN)
I can’t understand how it works exactly so after some tweaking I got sort of a desired result but had to change some parameters of the plane mesh and what’s more important I can’t get this plane to tilt with the camera (I attached a picture to better illustrate what I want to achieve in the end). It is doing everything else I need like rotating correctly so it’s always showing the right side where the texture is not culled.
Have anyone done anything similar and can help me? Would be grateful.
You made a spelling error. The function that you wanted to use is called _process(delat)
not progress.
Apart from that you might instead experiment with the “billboard” texture parameters. Because that seems exactly what you are referring to.
wombatstampede | 2019-05-02 11:46
I accidentally copied it wrong, of course I have it in _process
, but what is the billboard texture?
jackash | 2019-05-02 12:13
Yeah, I found what you were talking about, but it also gives some strange results. It rotates to the camera and somehow tilts too, but at some points it’s still becomes hard to see and even invisible, so it’s not facing camera directly. Maybe anything else you could advise?
jackash | 2019-05-02 13:20
Edit: Ooops, maybe assigning the Billboard Texture to a Cube?
See “Billboard Mode”:
Spatial Material — Godot Engine (3.1) documentation in English
wombatstampede | 2019-05-02 13:24
Cube is giving some terrible results, however the problem is only with camera going up and down, from side view everything is OK when I’m rotating it, but from the top view I almost see nothing
jackash | 2019-05-02 13:35
Did you also try the Billboard mode “Particle”?
The last time I used that mode was for smoke in CPUParticles. Worked fine for me.
Anyway as I said your code also generally goes in the right direction.
plane.look_at(camera.global_transform.origin,Vector3(0,1,0))
should let the z-axis of the plane point directly to the camera.
wombatstampede | 2019-05-02 13:57