Rotate Instances to Mouse Position

Hi all,

I’ve been looking around in the forums to see if there’s a method in which to rotate instances of a cube to face an arbitrary x/y coordinate. I’ve used the look at parameter, but that merely rotates all of them simultaneously. I’d like for the level of rotation to be determined by the proximity of said instance to the x/y position. Will keep fiddling with this, but any help is welcome.

Thanks!

You can use an object CHOP to get each instance to rotate towards a point:

If you’re following mouse position, you’ll need to provide a z coordinate for this to work.

You can also use the object CHOP to calculate distance, you could use that result as a scaler, or as a mechanism for determining if an instance rotates towards the mouse.

Hi Matt,

Thanks for coming to the rescue again. I got the rotation working, but I’m not sure how to implement the scalar method (which is indeed what I’m wanting). I imagine that there’s some need to multiple the mouse coordinates by the bearing values output, but here’s what I have so far if you have the time.

Thanks!

rotateInstanceTest.toe (4.7 KB)

Here’s a look at a few different options.

Unique Rotation is going to produce results where each instance is rotated to aim towards your null. Here the object CHOP is also used to calculate distance - which is used with a logic CHOP to produce a smaller area in the field (a bounding circle). A filter CHOP provides smooth transitions between 0 and 1 vals, and this is then used with a Math CHOP to gate the rotation:

Another example imagines that you just want an arbitrary rotation on a single axis, using distance only as a gating tool for determining if the rotation should or shouldn’t be applied:

Hope this helps!

rotateInstanceTes_edits.toe (5.5 KB)