How to program gravity for a pawn class with C++

I could use a character, a paper character, or a main pawn as well, however only the character class is compatible with set gravity direction node, but character class has other problems in my case. Since I cannot attach a pawn class (or default pawn) to set gravity direction node, how can I do it with C++?

Gravity must be modify all the time, by a line trace’ s normal direction, fired by the characters location. Whatever the incline of the surface the line trace hits, the gravity will be modified towards it so the character will always be able to walk in every surface(every incline) normally. You can think of my character as a slime with spiderman powers. I can provide more context if you like.

I opened lots of topics here, if you are really interested to help, you might as well take a quick look at some of them.

Since I don’t know about C++ at all, if possible (which I am not sure) I would prefer using a hybrid approach, just making the core part of the mechanic in the c++ and doing everything else in blueprint, as I said if possible. I am in need here. Thanks y’all as advance :slight_smile:

Or basically I could writed, I want to replace set gravity direction node with some code in C++ in a pawn class.

@ClockworkOcean @Mind-Brain

1 Like

In the pawn class, you can just make your own gravity code in blueprint, you don’t need C++. It’s only if you want to make changes to the player character that you’ll need it.

I have a pawn that does something like this, I’m hunting out the code…

1 Like

So replace set gravity direction node with it’s alternatives? Ok, but how exacly? Since I can’t use set gravity direction node in a pawn.

“It’s only if you want to make changes to the player character that you’ll need it.”

What does that means?

Can you see this snippet?

https://dev.epicgames.com/community/snippets/edit/KNxo

It’s enough to keep contact with the surface of a sphere, and any other shape without sharp edges

surface pawn

1 Like

It gives error 403 when I click on it. (No Access)

and now?