Main Content

addVisual

Add visual geometry data to rigid body

Description

addVisual(body,type,parameters) adds the visuals of a geometry of the specified type type and geometric parameters parameters to the specified rigid body body.

addVisual(___,tform) specifies a homogeneous transformation for the geometry visual relative to the body frame in addition to any combination of input arguments from previous syntaxes.

Input Arguments

collapse all

Rigid body, specified as a rigidBody object.

Geometry type for geometry, specified as a string scalar. The specified type determines the format of the parameters input.

  • "box"[x y z]

  • "cylinder"[radius length]

  • "capsule"[radius length]

  • "sphere"radius

  • "mesh""meshfilename" or {'meshfilename' scale}.'meshfilename' must either be an STL or DAE file name, specified as a string or character vector. scale is the xyz-scale of the mesh's bounding box, specified as a three-element vector of positive numeric values. The scaling is along the axes of the origin frame of the rigid body.

Data Types: char | string

Geometry parameters, specified as a numeric vector, numeric matrix, or string scalar. The type input determines the format of this value.

  • "box"[x y z]

  • "cylinder"[radius length]

  • "capsule"[radius length]

  • "sphere"radius

  • "mesh""meshfilename" or {'meshfilename' scale}.'meshfilename' must either be an STL or DAE file name, specified as a string or character vector. scale is the xyz-scale of the mesh's bounding box, specified as a three-element vector of positive numeric values. The scaling is along the axes of the origin frame of the rigid body.

Example: addVisual(body,"mesh",{"meshName.stl",[0.5 1 1]})

Data Types: single | double | char | string

Mesh transformation relative to the body coordinate frame, specified as a 4-by-4 homogeneous transformation.

Version History

Introduced in R2017b

expand all