direct.motiontrail.MotionTrail

from direct.motiontrail.MotionTrail import MotionTrail, MotionTrailFrame, MotionTrailVertex, remove_task

Inheritance diagram

digraph inheritance24cbc37995 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "DirectObject" [URL="direct.showbase.DirectObject.html#direct.showbase.DirectObject.DirectObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="This is the class that all Direct/SAL classes should inherit from"]; "MotionTrail" [URL="direct.motiontrail.MotionTrail.html#direct.motiontrail.MotionTrail.MotionTrail",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="Generates smooth geometry-based motion trails behind a moving object."]; "NodePath" -> "MotionTrail" [arrowsize=0.75,style=""]; "DirectObject" -> "MotionTrail" [arrowsize=0.75,style=""]; "MotionTrailFrame" [URL="direct.motiontrail.MotionTrail.html#direct.motiontrail.MotionTrail.MotionTrailFrame",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top"]; "MotionTrailVertex" [URL="direct.motiontrail.MotionTrail.html#direct.motiontrail.MotionTrail.MotionTrailVertex",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top"]; "NodePath" [URL="acron.core.NodePath.html#acron.core.NodePath",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "NodePath" [arrowsize=0.75,style=""]; }
class MotionTrail(name, parent_node_path)[source]

Bases: NodePath, DirectObject

Generates smooth geometry-based motion trails behind a moving object.

To use this class, first define the shape of the cross-section polygon that is to be extruded along the motion trail by calling add_vertex() and set_vertex_color(). When this is done, call update_vertices().

To generate the motion trail, either call register_motion_trail() to have Acron update it automatically, or periodically call the method update_motion_trail() with the current time and the new transform.

The duration of the sample history is specified by time_window. A larger time window creates longer motion trails (given constant speed). Samples that are no longer within the time window are automatically discarded.

The use_nurbs option can be used to create smooth interpolated curves from the samples. This option is useful for animations that lack sampling to begin with, animations that move very quickly, or low frame rates, or if sampling_time is used to artificially slow down the update frequency.

By default, the optimized C++ implementation (provided by CMotionTrail) is used to generate the motion trails. If for some reason you want to use the pure-Python implementation instead, set want-python-motion-trails to true in Config.prc.

geom_node

A GeomNode object containing the generated geometry. By default parented to the MotionTrail itself, but can be reparented elsewhere if necessary.

global_enable = True
motion_trail_list: list[MotionTrail] = []
motion_trail_task_name = 'motion_trail_task'
notify = <direct.directnotify.Notifier.Notifier object>
resolution_distance

This can be changed to fine-tune the resolution of the NURBS curve.

sampling_time

How often the trail updates, in seconds. The default is 0.0, which has the trail updated every frame for the smoothest result. Higher values will generate a choppier trail. The use_nurbs option can compensate partially for this choppiness, however.

classmethod setGlobalEnable(enable)[source]

Set this to False to have the task stop updating all motion trails. This does not prevent updating them manually using the update_motion_trail() method.

task_added = False
time_window

How long the time window is for which the trail is computed. Can be increased to obtain a longer trail, decreased for a shorter trail.

use_nurbs

Set this to True to use a NURBS curve to generate a smooth trail, even if the underlying animation or movement is janky.

class MotionTrailFrame(current_time, transform)[source]

Bases: object

class MotionTrailVertex(vertex_id, vertex_function, context)[source]

Bases: object