Rotate a sphere in the same direction the camera is pointing at

This is my third attempt to ask a question.

I’m trying to make an object move always in the same direction the main camera is looking at.
The problem is, I’m not really good at coding and don’t get it at all.
But I really want to understand this.
So, I’m using the movement script from the “roll a ball” tutorial. It’s working great and it’s understandable.

Now I want to rotate the player in the direction the camera is looking at.
But how do I do this?
When I move the camera by the mouse, I would need to rotate the player (which is a sphere) too.
But this way, the movement of the player would be interrupted, right?

Did you try this ?

player.transform.rotation = Camera.main.transform.rotation

Or just maybe cam, as a public assigned variable.

I figured it out. I’ll post my solution later this day :slight_smile: