Rotating Movement Component Question

Hey all,

So I have these balls that fall down in the level and the player taps them to break them. I am trying to make another version of these that “wobble” as they fall. I tried using a rotating movement component with a pivot offset but collision detection is disabled while this component is active. I tried using an lerpto component but then the balls simply wont fall. Does anybody have an idea for a workaround, or is Epic planning on ever adding collision to the rotating movement component? I’ll also note that physics isn’t simulated on the balls, they use a projectile movement component to get fired out of spawn and then bounce off the walls and each other as they fall.

Any ideas could help.

Thanks!

Hello @LordTorsten85,

I think I have a pretty good solution for you.

I will show my code and explain it below.

Essentially what I am doing above is creating a vector to add to my projectile component’s original velocity in the Tick event in the Blueprint containing my projectile component. I then set the projectile component’s velocity to this newly created vector. I create the vector used to update the velocity by using the Sine function to oscillate from -1 to 1 and the multiply that value to the Right Vector of the actor to make a vector with a left to right direction. I control the value coming from the Sine function by multiplying values before and after it. One of these values control the speed(frequency) of the wobble and the other controls the amount of wobble(i.e.the distance the object travels during the wobble).

Side Note: You can use any directional vector in place of the “Get Actor Right Vector” node. For instance you could use the “Get Actor Up Vector” node to make the projectile wobble up and down.

I hope this answer helps you out,

Farshooter

Thanks! That did it, for the most part. I had to do some modifications because the balls are spawned with a random velocity at the start, and if I spawned them this way they would just move back and forth and not fall. It had the same effect as the LerpTo component but it gave me a little more control. I ended up adding a rotating component and adding in the down vector to shoot it off in random directions with a much smaller wobble. It still needs some polish, but it was good enough to put in for testing.

I appreciate your input! I think I’ll be hopping back on Kahn Academy this weekend to keep working on my vector math.

Man I wish I paid more attention in math in school…

Thanks!

-Trevor