CMotionTrail

from panda3d.direct import CMotionTrail
class CMotionTrail

Bases: TypedReferenceCount

The method used in creating the motion trail is based on taking samples of time and transformations (the position and orientation matrix) in real- time. The method also requires a number of vertices (positions) that determines “shape” of the motion trail (i.e. the edge of a blade). A start color and end color is also required for each vertex. The color is interpolated as function of time. The colors are typically used to fade the motion trail so the end color is typically black.

The vertices are submitted via the “add_vertex” function. For each frame, a sample is submited via the “update_motion_trail” function. During the “update_motion_trail” function, the motion trail geometry is created dynamically from the sample history and the vertices.

The user must specifiy a GeomNode via “set_geom_node”.

The duration of the sample history is specified by a 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 nurbs option can be used to create smooth interpolated curves from the samples. The nurbs option is useful for animations that lack sampling to begin with, animations that move very quickly, or low frame rates.

The texture option be used to create variation to the motion trail. The u coordinate of the texture corresponds to time and the v coordinate corresponds to the “shape” of the motion trail.

Inheritance diagram

Inheritance diagram of CMotionTrail

__init__(*args, **kwargs)
addVertex()

C++ Interface: add_vertex(const CMotionTrail self, const LVector4f vertex, const LVector4f start_color, const LVector4f end_color, float v)

/**
  • Add a vertex.

*/

add_vertex()

C++ Interface: add_vertex(const CMotionTrail self, const LVector4f vertex, const LVector4f start_color, const LVector4f end_color, float v)

/**
  • Add a vertex.

*/

checkForUpdate()

C++ Interface: check_for_update(const CMotionTrail self, float current_time)

/**
  • Check if a sample can be submitted.

*/

check_for_update()

C++ Interface: check_for_update(const CMotionTrail self, float current_time)

/**
  • Check if a sample can be submitted.

*/

enable()

C++ Interface: enable(const CMotionTrail self, bool enable)

/**
  • Enable/disable the motion trail.

*/

getClassType()

C++ Interface: get_class_type()

get_class_type()

C++ Interface: get_class_type()

reset()

C++ Interface: reset(const CMotionTrail self)

/**
  • Reset the frame sample history.

*/

resetVertexList()

C++ Interface: reset_vertex_list(const CMotionTrail self)

/**
  • Reset the vertex list.

*/

reset_vertex_list()

C++ Interface: reset_vertex_list(const CMotionTrail self)

/**
  • Reset the vertex list.

*/

setGeomNode()

C++ Interface: set_geom_node(const CMotionTrail self, GeomNode geom_node)

/**
  • Set the GeomNode.

*/

setParameters()

C++ Interface: set_parameters(const CMotionTrail self, float sampling_time, float time_window, bool use_texture, bool calculate_relative_matrix, bool use_nurbs, float resolution_distance)

/**
  • Set motion trail parameters.

  • sampling_time = Can be used to specify a lower sampling rate than the frame

  • rate. Use 0.0 with nurbs.

  • time_window = a component for the “length” of the motion trail. The motion

  • trail length = time_window * velocity of the object.

  • use_texture = texture option on/off.

  • calculate_relative_matrix = calculate relative matrix on/off.

  • use_nurbs = nurbs option on/off

  • resolution_distance = the distance used to determine the number of geometry

  • samples. samples = motion trail length / resolution_distance. Applicable

  • only if nurbs is on.

*/

set_geom_node()

C++ Interface: set_geom_node(const CMotionTrail self, GeomNode geom_node)

/**
  • Set the GeomNode.

*/

set_parameters()

C++ Interface: set_parameters(const CMotionTrail self, float sampling_time, float time_window, bool use_texture, bool calculate_relative_matrix, bool use_nurbs, float resolution_distance)

/**
  • Set motion trail parameters.

  • sampling_time = Can be used to specify a lower sampling rate than the frame

  • rate. Use 0.0 with nurbs.

  • time_window = a component for the “length” of the motion trail. The motion

  • trail length = time_window * velocity of the object.

  • use_texture = texture option on/off.

  • calculate_relative_matrix = calculate relative matrix on/off.

  • use_nurbs = nurbs option on/off

  • resolution_distance = the distance used to determine the number of geometry

  • samples. samples = motion trail length / resolution_distance. Applicable

  • only if nurbs is on.

*/

updateMotionTrail()

C++ Interface: update_motion_trail(const CMotionTrail self, float current_time, const LMatrix4f transform)

/**
  • See class header comments.

*/

update_motion_trail()

C++ Interface: update_motion_trail(const CMotionTrail self, float current_time, const LMatrix4f transform)

/**
  • See class header comments.

*/