# Best way to plot an arrow in a MeshCatMechanisms visualizer?

**URL:** https://discourse.julialang.org/t/best-way-to-plot-an-arrow-in-a-meshcatmechanisms-visualizer/69717
**Category:** New to Julia
**Tags:** question, package, visualization
**Created:** [October 13, 2021, 10:35pm UTC](https://discourse.julialang.org/t/best-way-to-plot-an-arrow-in-a-meshcatmechanisms-visualizer/69717 "2021-10-13T22:35:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hkolano](https://avatars.discourse-cdn.com/v4/letter/h/5f8ce5/32.png) [@hkolano](https://discourse.julialang.org/u/hkolano)
#### Post date: [October 13, 2021, 10:35pm UTC](https://discourse.julialang.org/t/best-way-to-plot-an-arrow-in-a-meshcatmechanisms-visualizer/69717/1 "2021-10-13T22:35:46Z")

</div>

I’d like to get a result similar to the force plotting done in this issue: [Body wrench from forces applied at different points · Issue #589 · JuliaRobotics/RigidBodyDynamics.jl · GitHub](https://github.com/JuliaRobotics/RigidBodyDynamics.jl/issues/589). Unfortunately, the code for the actual visualization is not posted, so I’m trying to figure out how it was done.

I’ve been trying to use ArrowVisualizer from MeshCatMechanisms.jl:

```julia
using MeshCatMechanisms
using RigidBodyDynamics
using MeshCat
using GeometryBasics

vis = Visualizer()
render(vis)

mechanism = parse_urdf(urdf_file)

delete!(vis)

visuals = URDFVisuals(urdf_file)
mvis = MechanismVisualizer(mechanism, URDFVisuals(urdf_file), vis)

arrow_vis = ArrowVisualizer(vis)
setobject!(arrow_vis)
settransform!(arrow_vis, Point(0.0, 0.0, 0.0), Vec(0.5, 0.5, 0.0))

```

Without the last line, the robot arm is situated correctly on its axis, but there’s no arrow:

![arm_no_arrow](https://global.discourse-cdn.com/julialang/original/3X/b/5/b587b851eacf9201d755026a0d19a5b9c09950d0.png)

But, after setting the transform, the arm AND the arrow are transformed.

![arm_with_arrow](https://global.discourse-cdn.com/julialang/original/3X/e/2/e214965625f3f16954c754d3f6b1fe01f76ef59d.png)

It seems like I’m transforming both the “meshcat” visualization and the “arrow” visualization, possibly because they’re both linked to “vis”. Is there a way to transform just one? Or a better way to draw arrows or move this visualizer? Thanks in advance for any help.

---

<div class="post-metadata">

### Author: ![ga72kud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ga72kud/32/32180_2.png) [@ga72kud](https://discourse.julialang.org/u/ga72kud)
#### Post date: [June 17, 2022, 5:09pm UTC](https://discourse.julialang.org/t/best-way-to-plot-an-arrow-in-a-meshcatmechanisms-visualizer/69717/2 "2022-06-17T17:09:23Z")

</div>

My gues is to write your own function with

shaft = Cylinder(zero(Point{3, Float64}), Point(0.0, 0.0, 10.0), 0.1)  
setobject!(vis, shaft)

and the cone. It seems that the actual implementation ```  
settransform!(arrow\_vis, Point(0.0, 0.0, 0.0), Vec(0.5, 0.5, 0.0))

```nohighlight

```

---

<div class="post-metadata">

### Author: ![ga72kud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ga72kud/32/32180_2.png) [@ga72kud](https://discourse.julialang.org/u/ga72kud)
#### Post date: [June 17, 2022, 5:10pm UTC](https://discourse.julialang.org/t/best-way-to-plot-an-arrow-in-a-meshcatmechanisms-visualizer/69717/3 "2022-06-17T17:10:08Z")

</div>

similar question: [Simple line and arrows · Issue #217 · rdeits/MeshCat.jl · GitHub](https://github.com/rdeits/MeshCat.jl/issues/217)
