Parent transform forward as reference then need to ADD Torque to that

I am having trouble wrapping my head around a solution for this.

I am attempting to add torque to a sphere using the direction of its parent (camera) as the starting point. My trouble has been trying to add the torque vector to the vector forward of the cameras transform. I know this is easier than I’m making it.

My code is a mess from too many edits… If anyone has a code snippet in C#, I would be eternally grateful!

Thanks ahead of time! Answers is awesome!

Well, you could try something like this:

  rigidbody.AddTorque(transform.parent.forward * someTorqueValue);

But be aware that rigidbodies are wild! They rarely do what you expect without doing lots of annoying unexpected things. The instruction above, for instance, will make the object rotate around weird axes during some time before finally settling down to the desired rotation, and any parent rotation will start another disappointing weird sequence. Parent movements also aren’t immediately followed by the child rigidbody, which will move exasperating slowly in the movement direction - not to mention other movements in unexpected directions that will result from this.

If you simply want to rotate an object around the camera’s forward direction, avoid rigidbodies and simply use Rotate - like this:

public float rotSpeed = 360;
 
void Update(){
  transform.Rotate(0, 0, rotSpeed * Time.deltaTime);
}

This code rotates the object around its forward direction. If the object’s initial localRotation is Quaternion.Identity (Rotation field = 0,0,0 in the Inspector), it will rotate always around the parent forward direction, no matter to which direction the parent is turned to.

Thanks for the explanation! Sorry about the large bold text in the previous comment, :p.

Got it. So then we would simply use scripting to follow an object with a cam and similar instances?