pyvista.Follower

Contents

pyvista.Follower#

class Follower(*args, **kwargs)[source]#

Wrap vtkFollower.

A Follower is a subclass of Actor that always faces the camera. It is useful for screen-aligned labels and billboarding effects.

The Follower maintains the position and scale of the actor but updates its orientation continuously to face the camera.

Parameters:
mapperpyvista.DataSetMapper, optional

DataSetMapper.

proppyvista.Property, optional

Property of the actor.

namestr, optional

The name of this actor used when tracking on a plotter.

Examples

Create a scene with a Follower text that always faces the camera and a transparent cube.

>>> import pyvista as pv
>>> from pyvista import examples
>>> plotter = 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'
>>> _ = plotter.add_actor(follower)

Create a transparent cube that doesn’t follow the camera.

>>> cube = pv.Cube()
>>> cube_actor = plotter.add_mesh(
...     cube, color='MidnightBlue', opacity=0.3, show_edges=False
... )

Set the follower’s camera and show the scene.

>>> follower.camera = plotter.camera
>>> plotter.show()
../../../_images/pyvista-Follower-1_00_00.png

Methods

Attributes

Follower.camera

Return or set the camera of this follower.