Rotate an object to point at a target within simulation nodes

I’m using simulation nodes to move an object towards a target. This is part of a larger project where I’m creating a jellyfish that flocks towards an object.

My next step is to get the geometry to rotate towards the object its following, but I’m stumped on how to do it.

Here is an example of the nodes for the movement.
2024-12-09 20-05-29_giffed

And a screenshot of the node graph.

If anyones has any suggestions, I’d greatly appreciate it.

I haven’t tried, but I would use align rotation to vector using the direction you calculate from the target location (or the one after calculating the resistance, I’m not sure), and then rotate instance. Of course you’d need to change your single point to an instance, either at the very start (you would then need to store your attributes on the instance domain) or at the very end, using instance on points.

Also, storing post_position is probably unnecessary, since you can access it with position (which you already do), unless I’m missing something.

1 Like

I’m sorry, I should have clarified my full intentions from the offset. I have tried that approach, the problem it constantly target the object. In this case I want it to rotate towards the object when it accelerates. Here is the full use case:

2024-12-09 21-58-53_giffed

I do as you suggested at the end, outside of the sim zone. But as you can see above, it constantly orients towards the target. I want a more natural motion, with it only rotating each time it moves.

And you’re correct, storing the post position is unnecessary I think. There’s every possibility I was using at some point, but has since become redundent.

I suppose you can use the velocity attribute to lerp between current orientation and target orientation

pseudonodes :

This would have to happen inside the sim zone. The map range is there to control how much the velocity translates to rotation. You said “accelerate” but I assume you meant “move”, although you can derive acceleration from velocity quite easily

1 Like

Thank you for your reply, I will give this a try. Sorry yes you’re right, rotates as it moves.

I tried it and it looks like it’s not as easy as I thought -I get a completely erratic instance rotation for some reason. If I take the same logic (as pictured above) outside the sim zone, it works fine… not sure what I’m missing. Maybe someone else will point out the obvious.
Later,

You can rotate proportionally with something like this (x-aligned arrow in this example to match Direction vector):


… just make sure your Direction vector is in the right domain, e.g. Instances in this case.
Good luck.

2 Likes