Add discrete movement to Pawn
I want to move a simple Pawn object to fall from the sky upon being spawned but instead of simply crushing to floor it has to move on the Y Axis. This wouldn't be such a big problem if I made it move continuously as one would do with a Character object but I want it to use a discrete movement. What I mean is that it should move the same way the Tetris pieces do when they fall from the top of the grid: after X seconds, they drop down by Y centimeters and so on until they touch the floor.
asked Mar 02 '17 at 12:11 PM in C++ Programming
you could do something like this:
this will Move the Actor to the new Location in one frame, without affecting its physics velocity. It will also sweep, which means it will detect any object between it and its target position and stop if it hits something (the ground for example).
Check out the documentation page for more details:
You might also want to check out this page, which shows exactly how you can move a physics object and what teleporting and sweeping actually does in a visual way.
The only thing left to do is to actually calculate the new position. You might want to store a custom calculated veloctiy on your pawn, so you can calculate your new position each frame. The rest is simple algebra.
answered Mar 02 '17 at 12:28 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here