# Examples from pyvista.Follower
# ==============================

# Create a scene with a Follower text that always faces the camera and a transparent cube.
import pyvista as pv
from pyvista import examples
pl = pv.Plotter()

# Create the "Hello" text that will follow the camera.
text_mesh = pv.Text3D('Hello', depth=0.1)
text_mesh = text_mesh.translate(
    [-text_mesh.center[0], -text_mesh.center[1], 0]
)

# Create mapper and follower actor for the text.
text_mapper = pv.DataSetMapper(text_mesh)
follower = pv.Follower(mapper=text_mapper)
follower.prop.color = 'gold'
_ = pl.add_actor(follower)

# Create a transparent cube that doesn't follow the camera.
cube = pv.Cube()
cube_actor = pl.add_mesh(
    cube, color='MidnightBlue', opacity=0.3, show_edges=False
)

# Set the follower's camera and show the scene.
follower.camera = pl.camera
pl.show()

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

