I want to dive into the infamous gravity system of Unreal 4 to make a game where gravity can be controlled, but limited to only 6 linear directions.
I spent ages on a prototype about two months ago in attempt to make the Player Character a physics object, only to learn ultimately that* physics enabled naturally breaks the Character Movement *system of UE4.
I know free code with custom gravity already exists, but I wish to go through the hardship of creating my own code for sake of knowing how to do it in the future, and to have a project where I used only my code along with UE4’s blueprints. I am a total beginner for C++ and still have some basics to learn, but I generally understand what code is doing. I’m left needing to learn language and format. I’m currently seeking to understand parameters in order to relatively change how the hard coding of UE4 works.
Spherical gravity is unnecessary and cumbersome for my game which will feature heavily box shaped architecture to emphasize puzzle mechanics and limit the player’s range of movement (so my game doesn’t turn into a 6-degrees of freedom action game like Gravity Rush).
The goal is to create 6 distinct gravity modes that can be checked as conditions for both the **player **and physics objects (or binary variables as far as I know in UE4). I am aware gravity is still hard coded in UE4 to **pull towards -Z. **This feature isn’t exposed to blueprints (as far as I know). This means conditions for falling, Player Controller orientation, Glimbal Lock (which I need to change too to make the camera natural), Floor checks (for placing the character on the floor, as well as maximum walking angle), Jumping direction, and potentially more are all based on the default up and down Z direction. I need these all to change to a new “down” relative value.
- *I am trying to solve if it is a good idea to run a C++ code that mathematically adds X and Y float or rotation values to all related defaults to ultimately make gravity and movement **relative **to 1 of 6 player and volume controlled modes for the player. *
- Or would it simply be better to take the existing movement and default gravity code and make 5 C++ variants with modified numbers which would supplement the default parameters of UE4?
This is obviously unnecessary for physics objects, as no relative movement component is necessary. I have no AI’s planned. I will probably just make a simple system uniquely using force applications with Blueprints and turn of gravity on physics objects so the default world gravity (if this is simpler to change) doesn’t conflict with the.
The player character is the hard part.
- Is there a list of C++ parameters known to be uniquely bound to the Z axis and do they exist in the same Character Movement code?
- Can they be communicated in resulting X and Y values to the system?
Please feel free to include examples of code including the parameters even though I am still new.