Download

Handling environment physics in blueprints (sidescroller). How do I do this?

Hi,

I’m working on a game and I have decided that it is crucial to restrict movement in physics objects (round rocks for example) to blueprints only, instead of using actual physics. This is very important for the gameplay.
Since I am bad at explaining in words how I want the physics to work, here’s a image that should explain itself:

physicsbasic.jpg

When a rock is on a flat surface the rock stays still unless moved by the player.
-Both sides rounded = random
-Right side rounded = falls to right
-Left side rounded = falls to left

The problem with using real physics is that they just fly everywhere on the x and y axis (Only up down left and right in camera POV).
How do I go about achieving this is UE4?
If the method is too complicated can I get some guidelines on topics I need to study to achieve this? I hope It’s not too complicated to do for someone that is inexperienced in blueprints and programming itself.

Thanks!

No one knows?

You can restrict movement of the object to a specific axis. Look at the settings of the Static Mesh Component for example. This is for the physics based implementation, but I wouldn’t use it for this kind of game mechanics as it’s non deterministic and even if you manage to direct the side on which rock should fall there will be other cases which will add a bit of unnecessary randomness.

I would animate everything myself. Represent your level as a 2d grid, for each grid check if you have a rock there or not, if there is a rock then check if it should fall and on which side.
The older games which had similar mechanics had a strict procedure on how rocks where animated, so that you can’t have two rocks moving into exactly the same grid point at the same time. One would wait until the other one is passed.

Yes since this is a puzzle game it has to be deterministic.
That’s a very good idea, I need to find some info on using a grid in ue4

There isn’t any grid to use as such. What I mean is to represent your level as 2 dimensional array, where each element fits just a single object, be it an obstacle or a rock.