How do you make object stick to another object

How do I make an object move across the surface of another object but also follow whatever movement that object had? Like lets say I had a bug crawling on a machine arm, how would I make the bug walk only on the surface of the arm while also having it “stick” to the surface so that the bug stayed on the surface of the arm as it moved but was free to move across the arm however I decided?

If the bug moves on a local plane (rectangular robot arm):
Parent the bug to the arm and animate in local space on the plane.

If the robot arm is a cylinder:
Create a curve and snap its vertices on the cylinder accordingly to the animation path the bug should translate.
Parent the curve to the robot arm.
For the bug, add a ‘Follow Path’ constraint and select the curve as the target.
select the curve and set keys for the evaluation time.

If the arm is organic and deformed by an armature:
Same as above, but glue the path to the arm by adding a MeshDeform modifier to the path.
For the MeshDeform geometry duplicate the arm geo, scale it up a little, (simplify the geo if desired), make it un-renderable and use it as the MeshDeform object.
Bind the path to the MeshDeform geo.
Since the MeshDeform geo is a duplicated version of the arm, the armature deforms it the same as the arm.

Now the bug goes along the path which is deformed by the MeshDeform geo which is deformed by the same armature as the arm.

That seems really complicated, I don’t yet know the path I want the bug to take. I was thinking there would be some way to use the “child of” constraint?

Child Of Constraint is similar to parenting the object, with additional possibilities like: to parent only particular channels (rot, scale,…) and to switch the parent relation on/off by animating the influence slider.

Comes in handy for example when a hand picks up an cup etc.

Ok…so could you expand on that? I have something that can rotate in any direction, but something else moving along with it. Would it make sense to use a child-of constraint if I switch the influence of different child if constraints for each section of the armature the objection passes across?

What I really want is just for this one object to stick to the surface of this other object at all times, no matter how I animate them.

Also, explain how to use the Child of Constraint from having an object attached to a bone to another object. I need to know as well.

Never mind on the child of constraint. It was a different matter compared to what I was going through. But, I was able to find the answer to my solution.

@ PixelLoveLLC
As mentioned, you don’t need the ChildOf Constraint if the object doesn’t change parents and you don’t want to exclude individual transformations.

Example how it works:
Create a cube; create a smaller cube on top of that bigger one.
Parent the smaller cube to the bigger one (Ctrl P).
Animate the bigger cube. The smaller cube goes with it. Nothing new there…
Now animate the smaller cube in LOCAL SPACE (with Shift-Z-Z for locking local Z so it sticks to the surface of the bigger cube).
If you change animation of the bigger cube, the smaller one still goes with it since it is the child of the bigger one.

But what I mean is, what you’re saying only works because it’s one cube with one bone. If I try that on something with multiple bones, parenting the cube to the whole mesh won’t make the cube deform with the surface of the mesh of every bone.

What about some kind of gravity + collision thing? Not that I know much about blender physics but would gravity + collision make another object hit the surface frame by frame, if the object itself had gravity?