Here is my issue, I’m creating a game where a marble is rolling and has to pass several obstacles.
As the player control the “marble”, player controls a pawn (and not a "player character).
I’m using the “Add Torque in Radians” in order to make the marble roll
Screenshot1: BP movement (torque)
Everything is behaving as expecting and the marble is rolling without any issue.
Then, I would like the player to be able to change the size of the marble (make it smaller and make it bigger) by pressing an action button.
It becomes something like this:
Once again, the change in scale is perfectly working. However, the marble is not rolling as intended anymore.
When you press “forward”, it goes “forward” and “backward” and is stuck in a weird loop.
Here is a video of what’s happening:
As you can see, once the marble becomes bigger, it’s doing weird movement.
Do anyone has any idea in order to fix this?
Additionnal info 1 : I’m not sure at all but I tried to increase the default size of the marble and it was rolling as expected. My guess is the “scale actor” is messing with the physics of the ball.
Additionnal info 2: I tried other function nodes such as “Scale actor 3D” (without or with relatives) and the same issue is occuring.
Thank you very much for your help guys !
There is one solution: disable both physics and collisions before the scale and activate them again afterwards. However it will stop all movement when the scale changes:
Here is the final form, that will keep the previous movement:
It saves both the linar and the angular velocities and then restores them.
What kind of collision are we talking about here? Sphere collision that is attached to the static mesh?
Here all the details regarding the static mesh. No sphere collision attached. Do you think that it’s related to the issue?
Nah, that should be fine. You’re scaling the sphere uniformly, too. I know that scaling physics bodies works fine in the editor - I don’t think I tried it run-time, though.
Do have a look at EvilCleric’s solution. Sounds like a workaround but may not be applicable since it may affect the gameplay.
If that fails or misbehaves, you may want to replace a static mesh with another, larger one instead of scaling the existing one.
However it will stop all movement when
the scale changes:
One can store the linear and angular velocity and reapply it after the change. I used it once in a pinball game and it did work afair.
It saves both the linar and the
angular velocities and then restores
Yeah. I’m slow today.
It works like a charm, thank you very much for your help !
I am really curious, what was the issue there??