How to orient geometry towards a target position or along their velocity?

Hey TD community,

Im trying to create fish in water using pops. When their points move around, I’d like to have them ‘swim’ towards the direction they are moving in, i.e rotate them to point towards the new heading. Currently I am using mouse input with a cache to create 2 point (past point to current point) to draw a vector between. In the final version, the fish will swim from off-screen towards generated random points (current point to new point).

POPs are interesting, but I have a hard time applying the math I want with the nodes in Touch Designer.

How do I make the points, point toward new points (matching point IDs)?
(Bonus, how do I make this topic easier to find for new users with the same question?)

Thanks for reading,

Bas

Hi @Baas

maybe on the question itself first. In theory the angle between 2 points can mean 2 things:
If each point represents a vector from a origin, then you are looking for the angle between two directions.
If the two points describe a vector then you are looking for the bearing of the vector itself which is easier to understand when thinking of it as a azimuth (heading in the horizontal plane) and altitude (or elevation: the angle above or below the horizontal plane).

Since you already have a direction (the vector between the two points: target-fishPos) you can save this with each point that represents the fish’s position (I’m assuming in a particle system) and use it as a attribute for the Rotate To Vector parameters on the Instancing page of a Geometry COMP.

I think this video actually steps through the complete process and might be helpful:

Perhaps your question could have titles like:

  • How to orient geometry towards a target position
  • How to orient geometry along their velocity

cheers
Markus