Download

Problems with gravity/physics

So, hi i’m Nicola and i’m creating my own project. I wanted to create a fake garvity using a “Add Force” like the real one, but instead of a float a vector. By that, I could also set the gravity right, left, forward and backward. I understood how to do it, but i came across to some problems: the first one is that ( images below) when i set the new fake gravity, it all works pretty much as i want to, but the walkable floor doesn’t change, so it’s like if he’s falling, even if it’s on something. How can i set the walkable floor when i click up? The second problem is that when i click down to set the fake gravity as the original one it doesn’t work and when i stop playing it shows a warning says “Warning MyCharacter_C_16.CollisionCylinder has to have ‘Simulate Physics’ enabled if you’d like to AddForce”. So i go to CapsuleComponent and i enable simulate physiscs, and when i play it all completly messes up. How have i to do it :frowning: ? Thank you very much for any help.

U4 Screen N1.png
df937019428130cfeaf3d209a273325c2099afc0.png
U4 Screen N3.jpg
U4 Screen N3.jpg
2b7a02710b1289fc836b8c9a59f106daa3172a4b.jpeg
U4 Screen N6.jpg
b1a4f38e13c081b5f03e002ee21907949d811429.jpeg
U4 Screen N8.jpg
00b2a57d844e960ba2039547463048fe63159b0c.jpeg
7cb09a28918b55750930f4f18824be624aece2b5.jpeg
U4 Screen N11.jpg
U4 Screen N12.jpg

UP :c i beg you, i need to know if i can fix or not the problem :frowning: it would be disappointing if i can’t, but at least i would give up and look for some other cool features for my project :frowning: and also the enable default gravity problem is a big one…

I think you are trying to do something that is not meant to be done using the default CharacterMovement.
The capsule collision is used by the CharacterMovement component which basically fakes/simplifies physics movement (to make things more controllable) which means there are no real rigid body physics going (hence the Simulate Physics is disabled by default on the capsule) so I’m not sure forces is the way to go.

That’s probably because the movement component is tracing below to detect the floor.

Again, the CharacterMovement component is meant for “normal” and simple character movement setups… so it will not be that simple (if you know C++ then I would highly recommend making a custom CharacterMovement component).

The CharacterMovement has a Gravity Scale variable so you could use that instead of forces (for example scale = -1 will reverse the gravity) but the walkable floor will have to be done manually I guess (I’m not sure if it can be done via blueprints but take a look at Walkable Floor Angle and Walkable Floor Z parameters… it is possible that this is all you need).

Quick note: please avoid posting this many images in the future :stuck_out_tongue: it makes things harder for us to help you… instead try to keep the description as short and meaningful as possible, you will get more replies that way :wink:

THank you VERY much! However i’ll explain as fast as i can what i want ( and keep trying) to do: i want that when the player click up the gravity ( only for the character) is set to up, when he click right the gravity is set to gravity and so on, but the character has to rotate too and where it can walk with it. By this way the gameplay by our view could be a big point for gameplay.

Now, the main problem is that do this would be easily if the gravity scale would be a vector and not a float and as you said this is not meant to be done using the default CharacterMovement. I’m learning C++ both on my own and at school, but i don’t think that i’m already able to use C++ properly, even if i’ll give it a try. I took a look at walkable floor and walkable z parametres, but it isn’t what we’re talking here. Those things are used when you’re on a tilted thing and the engine has to determinate if the character is still able to walk on it or if the character can’t and will fall, for example the limit is 89.99 because if you set it to 90 it causes big problems because it’s like if the character could walk on a wall. I read somewhere that if i wanted to do this as you said i have to do and program a custom physics/character movement. So, there really isn’t a simple way to do this with blueprints? Do i absolutly have to do it by C++? This won’t be painfull for me, but it will takes me a BIG amount of time because i’ll have to learn and mostly to look for anything that i need. Thank you TK-Master :slight_smile:

I do not believe that you have to do it in C++ but seeing how the default movement component is done will probably help you quite a lot and it could be a matter of overriding a couple of functions there (not sure).

Check out this post… this guy has done something similar and I believe he even posted his movement component code in github so if you are going to go the C++ way, definitely check it out.