# Simple example of 3D movement following a point?

**URL:** <https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361>\
**Category:** Coding Questions\
**Created:** [June 28, 2019, 3:32pm UTC](https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361 "2019-06-28T15:32:16Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 29, 2019, 8:57pm UTC](https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361/18 "2019-06-29T20:57:46Z")

</div>

I understood very clearly and shared with you my thinking on this.

I did not have an example to share with you; I did write one but I will not be sharing that.

The first thing I did was start considering this without looking at other code.

> [@glv](#):
>
> I used modelX(), modelY() and modelZ() to get the x, y, z co-ordinates and drew a line from A to B.

I considered the “midpoint between 2 points” and wrote a general function to place a point anywhere between the two points A and B along that line.

From there I was able to move that point anywhere along a line between 2 points A and B in 3D space:

> [@Creating Animated GIFs in Processing](https://discourse.processing.org/t/creating-animated-gifs-in-processing/12386):
>
> I have a new hobby! slight_smile

And now I am having fun with it!

Your example inspired me and I created my own project for this from scratch. Thank you!

glv

---

_[View the full topic](https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361)._
