Hey there,
I am trying to rotate a meshs Yaw Value for 360 degrees over a period of 10 minutes (let’s say). Would this be possible with this code snippet I created or do I need to tweak things and if so, what?
Thanks alot! That sounds promising. However I could not seem to find it in the documentation. Would you mind to explain the parameters of the function to me? StartLocation and StartRotation are pretty obvious but what are those booleans and where to set the time over which my mesh should be rotated? Also, is it always rotated 360 degrees or can I set this number anywhere? I guess doormesh is the mesh you want to rotate? From where do I call this function because you said it doesn’t needed to be called from tick?
Pay attention when using MoveComponentTo. To rotate 360º, you will have to called it at least twice. For example: once for 0º->180º and again for 181º->360º. Otherwise, if you call it once for 0º->360º it won’t rotate. For 0º->359º, it will rotate directly from 0º to -1º.
Ok, I will keep that in mind thanks!
But where do I actually pass into the function how many degrees it should rotate? As I see, there are only parameters for starting location/rotation and time but no parameters for amount of rotation or new rotation/location.
There are no “starting location/rotation and time”. *TargetRelativeLocation *and *TargetRelativeRotation *are the final location/rotation of the component. So, if you want to make a 180º rotation in situ in 10 seconds, then,
The rotation rate of *URotatingMovementComponent *is directly related with time:
Rotation rate = (0,0,90) => makes a 360º yaw rotation every ~4s
Rotation rate = (0,0,180) => makes a 360º yaw rotation every ~2s
Rotation rate = (0,0,360) => makes a 360º yaw rotation every ~1s
So, for 10 minutes 360º yaw rot: Rotation rate = (0,0,0.6f)