Dynamic gravity for characters

link is broken

I have been waiting for for a long time!!! your link is for some reason broken so could you help me on how to get the version with your code in it? i am already downloading the promoted branch hoping it comes with it but any more info on how to use would be greatly appreciated.

thanks in advance

ps: awesome work again!! :wink:

The link is broken if you aren’t logged in GitHub or you aren’t in EpicGames organization.

Once you get ‘promoted’, you have to get my pull request or download my two modified files, and recompile UE4.

I don’t know why it took my reply so long to get sent since i actually sent another asking something else which i also found the answer to later :))

But for the most updated question!!! i have downloaded your fork of unreal engine 4 and found and copied the charactermovementcomponent.h and charactermovementcomponent.cc to a safe location :smiley:

So now i have downloaded and will build the promoted version after that i should just replace the promoted files with the two from yours and rebuild correct?

Thanks in advance :wink:

EDIT : so i did the above the engine built correctly but there was no node added related to gravity so i probably missed something would be realy happy if you could help

EDIT 2: ok so i think i had to generateprojectfiles (for noobs like me who might make the same mistake)its now working just wondering why all the nodes related to gravity are doubled? there are two identical nodes for everything

Other than that its awesome! just one more thing i will be playing around with until epic adds it to the main branch and hopefully 4.8 will include it but for now the github builds have shown to be realy uncoopretive when it comes to packaging for ios and android so any way to add the current launcher version of ue 4.7.3? i was thinking of copy pasting your code on to the classes just by opening vs from inside the editor and rebuilding in that way do you think it’l work?

Also would be nice if you could give a list of classes and functions you’ve added that we can use.

Again thanks alot for :wink:

You can probably use the more stable 4.7.3 code branch (don’t forget to replace the two CharacterMovementComponent files before recompiling), but I can’t guarantee it will work because I didn’t test that. Make sure you don’t delete what you already have with ‘promoted’.

No idea about the two identical nodes. You can see the changes if you compare original with modified versions of the files by using a diff program like WinMerge.

any i could get the two files ?

i am interested in how exactly you got to work because i am working on something similar

You can do it yourself :slight_smile: like he said, register an epic games acc, assign it to your github profile and you can see all changes.

Any general Actor or Pawn support is coming at some point? I want to use the of dynamic gravity with Wheeled Vehicle Pawns! Thanks.

Hi

is looking great.

One question: did you or do you plan to test it with mobile devices tilt input? The part of the video where you set the gravity direction suggests that it should work “just like that”, but… does it? :slight_smile:

I didn’t modify gravity direction with tilt input, but I don’t think there would be problems because of that.

That’s up to Epic, but first they have to take the time to integrate my changes, which are a lot. Maybe they have further plans for other classes.

thanks i don’t know how i missed that github account field…

hey there i was wondering how you acheived to get the gravity to be the center of the sphere or in general how to make the gravity based on the floor angle (i could probably set it up using the ray trace to the floor from the character but just wondering :)) )

also could you refer to us where you set up the gravity stuff so we could possibly change the gravity of actors in general (now that would be legendary)

thanks for the hard work, I really hope gets merged in soon

looks really cool, would love to try it. problem is im really inexperienced with github so i cant seem to find out how to get hold of the two files, or a copy of the entire project with the two files merged. i do have epic linked git account so thats not the.

If you just want the code, visit each link and click on the “Raw” button (there might be a better way):
https://github.com//UnrealEngine/blob/Arbitrary_Gravity_Orientation/Engine/Source/Runtime/Engine/Classes/GameFramework/CharacterMovementComponent.h
https://github.com//UnrealEngine/blob/Arbitrary_Gravity_Orientation/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp
Remember to recompile the engine code.

Use code in the .cpp file (find and replace functions):


void UCharacterMovementComponent::UpdateGravity(float DeltaTime)
{
	if (IsMovingOnGround())
	{
		SetGravityDirection(CurrentFloor.HitResult.ImpactNormal * -1.0f);
	}

	UpdateComponentRotation();
}

FVector UCharacterMovementComponent::GetComponentDesiredAxisZ() const
{
	if (IsMovingOnGround())
	{
		return CurrentFloor.HitResult.ImpactNormal;
	}

	return GetGravityDirection(true) * -1.0f;
}

About changing the gravity of other actors, I didn’t do anything about that, but I remember there were threads about that matter in these forums.

Hi ! Con you re-up your work ? Thank :slight_smile:

The source code is still there and available. Log in to Github.

Now work i forget to link my UE4 account to Github

Bolded for emphasis. If you have set up an Unreal Engine account and followed the instructions to access the UE4 source code on Github, you will be able to see the forked repository when you log in.

Just what I’m after (I think, grabbing the code and testing to see if it suits)! Thanks for sharing :).

i downloaded the modified unreal version and compile it then i created a third person template and it does not seem work, can someone guide me or tell me if there is other steps i skept or still to do??

Hey everyone,

I was wondering how could incorporate into a blueprint project?