Clamp rotation between two components

Hey,
here is a math question (I guess).
On my pawn, I have a skeletal mesh with a look at, moving along with a motion controller (VR). It’s rotation is defined by the look at and the controller location.
A child actor is attached to the pawn. I want it to be located where the motioncontroller is, but have a clamped rotation depending on the previous skeletal mesh.
I know how to define its location and rotation depending the motioncontroller, but how can I limit the rotation ? It has probably something to do with inverse transform rotation and so on, but I can’t figure out what exactly.
Could someone help me ? Thanks !

In case this was unclear : I want the child actor to be rotating with the motioncontroller but prevent it collides with the skeletal mesh.

Okay I’ve got some result with this setup :
Get skeletal mesh world rotation, get min/max values by subtract/add the clamp value (45° in my case).
Get the relative rotation of the controller, clamp this rotation with previous defined min/max values and set new actor relative rotation with these. BUT X rotation flicks, I had to remove clamping on X axis.

However I have another child actor which needs a local offset, and this clamping doesn’t work if I add any local rotation offset. Any other idea ?

Nvm I’ve add a local rotation on a children component (added a scene component in the bp).

1 Like