Hi everyone,
How are we all doing? I hope that you are well.
I have been following along the FRotator lecture, I am currently at around 5:38 in the video, which is where Sam is about to set a challenge.
Not only that, but I had previously already changed up my cubes to be spheres instead. Likewise, I was then patiently waiting for the FRotator lecture, in the hope that it would aid me, and point me in the right direction of making the spheres rotate as they move, which they now do. (Kinda, as can be seen below).
However, of course, they only rotate in one direction. The way I have the spheres set up, is the same way in which we set up the cubes earlier on, which is to traverse left and right, (or forward and backward if you so wish).
I thought that a simplistic way to solve this so that it would reverse the rotation direction might be to just follow suit with what we did for changing the velocity of the platform. Where in the MovePlatform()
function, we just simple set PlatformVelocity = -PlatformVelocity;
. So naturally, I assumed we could simply do something like: RotationVelocity = -RotationVelocity;
! However, this returns a nice little error: no operator "-" matches these operands
.
So my questions are:
“Is there a simple way in which this can be achieved?”
“Would we be better off using a vector so that we can manipulate the value to be negative?”
“Would we be better off adding some conditional logic to the blueprint itself that perhaps checks to see if the MoveDistance has been reached, if so then update the value”
— Note: I guess in this scenario, we could maybe set up a boolean variable as a flag that toggles between true and false based on if the Move Distance
is Greater or Less than. Then we could probably use a branch to check that flag and set the RotationVelocity
accordingly?
Look forward to hearing every one’s thoughts on this. Apologies if it is covered later on.
Kind Regards
David