Object CHOP Techniques

The Object CHOP has long been one of the most challenging CHOPs for me to really wrap my head around. Following along with some conversations on the Facebook Help Group, it’s clear that I’m not the only one who has bumped their head against how to take advantage of this operator.

With that in mind, here are a few tricks and techniques that you might find helpful when working with the object CHOP.

Distance Between Many Objects Part 1

At first glance, it seems like the object CHOP can only perform calculations between single objects, but in fact you can use this operator to perform calculations between many objects provided that you format the input data correctly, and set up your object CHOP to account for multiple samples.

In a first example let’s say that we want to find the distance between several green spheres and a blue box:

First let’s collect our position information. I’ve used a an object CHOP per sphere to find its distance, but you might also use a script CHOP, or a put positions in a table that you reference for the spheres, or drive them with custom parameters. How you position them doesn’t matter. What we need, however, is a single CHOP with three channels that hold the transformation information of those spheres. My trick in this network is to use object CHOPs to find their positions, then put them in sequence with a join CHOP:

Next we can use a single object CHOP that’s fed reference positions from this join CHOP, and a target Geometry COMP:

Other important pieces here are the start and end parameters on the channel page.

This is where we set how many samples the object CHOP will evaluate. This can be a bit confusing - here especially as the join CHOP has started at a sample index of 1 rather than 0. The devil is in the details, so it’s worth keeping a close eye for these kinds of oddities. Because of this we compensate in our start position by moving back one sample index.

Next make sure to set your object CHOP to output measurements, and distance. What you’ll then end up with is a single channel with a sample for each distance between your box and spheres. We can convert this to a table if we wanted to see the actual values:

Distance Between Many Objects Part 2

We may also want to measure distances between multiple blue boxes. Say, for example, that we had two different blue boxes and we wanted to know the distances of our spheres to both of those boxes?

Similar to our first exercise we’ll start by collecting all of the position information for our spheres. We also need position information for our boxes. In this case, however, we need to stretch a single sample to be 4 samples long - this is part of our data preparation step to ensure we correctly calculate distance.

Here a simple stretch CHOP has been used to make sure we have four samples of data for each box. Next we can join this data so all of our box position information is in a single set of CHOP channels:

Before moving on, we need to take a moment to adjust our sphere position data. In our first example we only collected the four positions… we need to set up the correct extend behavior for this series so that our CHOPs know what values to use when CHOPs of mismatched lengths are combined. We can use an extend CHOP set to cycle to do this trick:

Finally, we can then use an object CHOP to calculate the distance between our box and our spheres:

Distance Between Many Objects plus Bearing

If we also calculate the bearing between our boxes and spheres, we’ll end up with rotation information… what can we do with this? We could use this to calculate the correct rotation for a set of instances. For example:

Here each line is correctly rotated, scaled, and placed based on calculations from the object CHOP.

Bearing

You can also use the object CHOP to just calculate bearing - or rotation from one object to another. Here you can see how this might be used to rotate instances to sit flat on a sphere’s surface, or rotate an arrow to point towards an object:

Bearing and Distance

Or you might use the combination of bearing and distance to make some strange abstract art:

Collision

You can also use the object CHOP to simulate a kind of collision calculation where the distance you’re measuring can help you tell how close an object is to another and if they’re on top of one another:

Attached is a example file where you can explore some of these examples.

theObjectChop.toe (16.9 KB)

8 Likes

@ben and @greg - if there’s anything in here that you think is worth pulling into op snippets please feel free :slight_smile:

3 Likes

Nice one :slight_smile: Object CHOP is a hidden gem (like Fan CHOP!)

2 Likes

Thanks for preparing this. Huge help! Though going thru the example was wondering if one more distance example would be useful. ie using the same objects for both reference and target. I couldn’t seem to get it working.

Can you say a little more about this? What’s a good example of the kind of situation you’re thinking about here?

@raganmd thanks for putting this together! Did not know about multiple samples - verrrrry useful.

1 Like

Yea the multi-sample was very surprising! I wonder if this has any use in a snapping system.

2 Likes

@TimFranklin - I bet there is. You could use something like the logic example right? Snap based on a distance threshold. I think there’s a way to do some of that work there for sure.

Oi Matthew! How often I have wished in the last years to calculate distance for multiple objects in a single Object CHOP. Amazing how I overlooked this option. This is a GREAT tip! ten points maestro.

cheers, Idzard

2 Likes

I’ve definitely made my own chop networks in the past to do this… understanding how to do this with Object CHOP was a real “ah-ha!” moment for me. The other one that really got me was the ability to calculate the length of a vector in a math CHOP. The fact that it’s a drop-down really did me in one day.

1 Like

hahaha yes I had the same onceI finally discovered that length option totally by accident in the Math CHOP - I would have never guessed. Love that these little surprises still keep coming after so many years of using this

2 Likes

Hi, @raganmd -san.
Thank you for sharing useful article.
I have tried to connect operators following your guide, but one problem happened.
My object chop has showed me rage more than the numbers I have filled.(from -2 to 1, like picture attached).
I have solved this problem using Trim chop, but do you have any idea about this output?

thank you,

Hi @narumin256!!

I think what you’re seeing is because your object CHOP is set to seconds rather than samples. There’s a drop down menu on the right hand side of the start / end parameters that lets you change between those.

1 Like

I could solve this problem because of your answer!
Thank you so much, @raganmd - san !

1 Like

I am a big fan of the Fan CHOP.

Sorry, couldn’t help myself…

1 Like

Hey Matthew, this would be so good to share in Community too!

2 Likes

Like any Matthew tutorial, so clear and useful, thank you.

1 Like