TrailRenderer
Render a trail behind particles.
Templates:
- Rigid3d
- Vec3d
Target: Sofa.Component.Visual
namespace: sofa::component::visual
parents:
- VisualModel
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
enable | Display the object or not | 1 |
position | Position of the particles behind which a trail is rendered | |
nbSteps | Number of time steps to use to render the trail | 100 |
color | Color of the trail | 0 1 0 1 |
thickness | Thickness of the trail | 1 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
Examples
TrailRenderer.scn
<?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.01">
<DefaultAnimationLoop/>
<Node name="plugins">
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Forward"/> <!-- Needed to use components [EulerExplicitSolver] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [TrailRenderer VisualGrid] -->
</Node>
<VisualGrid size="20"/>
<DefaultAnimationLoop/>
<EulerExplicitSolver/>
<MechanicalObject template="Vec3" name="particle"
position="0 0 0 0 0 0 0 0 0 0 0 0"
velocity="5 5 0 -5 5 0 7 7 0 -7 7 0" showObject="true" showObjectScale="10"/>
<UniformMass totalMass="1.0"/>
<TrailRenderer template="Vec3" position="@particle.position" nbSteps="200"/>
</Node>
def createScene(root_node):
root = root_node.addChild('root', gravity="0 -9.81 0", dt="0.01")
root.addObject('DefaultAnimationLoop', )
plugins = root.addChild('plugins')
plugins.addObject('RequiredPlugin', name="Sofa.Component.Mass")
plugins.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Forward")
plugins.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
plugins.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('VisualGrid', size="20")
root.addObject('DefaultAnimationLoop', )
root.addObject('EulerExplicitSolver', )
root.addObject('MechanicalObject', template="Vec3", name="particle", position="0 0 0 0 0 0 0 0 0 0 0 0", velocity="5 5 0 -5 5 0 7 7 0 -7 7 0", showObject="true", showObjectScale="10")
root.addObject('UniformMass', totalMass="1.0")
root.addObject('TrailRenderer', template="Vec3", position="@particle.position", nbSteps="200")