Rotate an object relative to another's y axis

I have a ball moving through a curved tube, there are cylinders spaced through out the tube that act as gates. The ideal is that when the ball passes through each gate the ball will be rotated along the gates y axis so the ball matches the rotation
Essentially the ball will be at some odd angle, the cylinder/gate will be rotated around the y axis, and i need to rotate the ball so its forward matches the cylinder’s forward. I suppose it could be done by making the ball a child of the gate rotate it then separate them again, but that is so incredibly in efficient.

are you simply saying:

you want to rotate theBall around some specific axis, “specialAxis” ?

If so, you do that using this:

Documentation/Documentation/ScriptReference/Transform.RotateAround.html

if “specialAxis” is the y axis of some otherObject, basically that is

specialAxis = otherObject.transform.up

specialAxis could be anything you want.

if you’re saying you basically want them to match the “overall orientation and look-direction” (so to speak), you simply set the rotation quaternions

theBall.rotation = otherObject.rotation

Note - that is very common when you simply copy an object in the scene – often you want the new copy to have the same orientation as the old item, and that’s the line of code you see for that.

NOTE … what you said about making it a parent, operating, and then un-parenting. There is absolutely nothing inefficient about that. it’s a great idea, and is normally done all the time in game code. It is completely normal. (Fundamentally all you’re doing is setting one simple field!!) It’s very ingenious because you’re simply, ultimately, using the transform matrices inside the engine, which is great. TBC I think it is irrelevant to your problem at hand here.

if none of this is it, you will have to explain it MORE CLEARLY !! hope it helps!