Alright, I decided to do it right now so that I don’t forget.
What I did was use the rolling ball temple (assuming you did the same).
The problem is the ball itself and physics, now in a normal character actor we get the “character movement” component which helps in adjusting a lot of things like gravity, velocity and what not.
In this we don’t, it simply has a mesh which has physics enabled and some controls that are driven by variables.
So, manipulation of mass does not help us,
Now, in the default scenario, I created an elevator that moves with the help of a timeline (Assuming you would have also done the same thing). Here is the code.
When the timeline is set to its default of 5 seconds, everything works
fine-ish, it is just that the elevator moves slowly. The problem is when you make the elevator do a sudden movement. Because no matter what the elevator will move and the ball will follow physics.
So, the solution that I found was, to off-course make the ball stick to the ground, which is done by the almighty GRAVITY. But as we have no character movement component, we cannot change the gravity inside the BP (AS FAR AS I KNOW, WHICH IS NOT THAT MUCH).
What you need to do to try this out if you like is -
- Follow this tutorial to override the world default gravity - (Set it to a very high value like -1000). THIS WILL EFFECT every single physics object in the world.
- Now mass comes into the picture as when you now collide with other physics object, not much force will be applied to them. So to correct it you need to increase the mass of the ball.
So summarizing my 15 minutes of experimenting,
Two possible solutions -
- Either don’t make the elevator do a sudden movement.
- Follow the above three points.
You will see it all comes down to level design in a physics based game. You need to think a little like a physicist.