Limit the movement of an axis

How could I freeze my character on a specific axis,
here is a scenario:
let’s say that my character can run on walls in a straight lines, when it’s running I should limit it’s moving axis so the gravity have no effect, and when the character decides to jump off the walls I should make it free again.

I’m looking for something like constraints in Unity3d gaming engine

There are options in the Character Movement Component to constrain the character to a plane (you specify the plane), and I think you can also modify gravity, combining those might get you what you need!

Thank you !, Is that also working with Pawn ?? if not how to do it for pawn ?

EDIT: sorry that was dump of me, Character have an Is-A relationship with Pawn since Character is extended from Pawn, correct me if I’m wrong.
so I believe it should work !

EDIT2: Sir, would u mind making me an example showing how to do so in a basic simple easy way :slight_smile: ?

First open your pawn blueprint, which you can find labeled as Pawn under Blueprints toolbar button of the editor. Then go to the components tab at the right and select “CharacterMovement” component at the left. Now in the details panel find this section:

And hover the mouse over each of the properties to see how you can use it.

-Edit: To give a simple example, let’s say you want to “freeze” y axis so the game will happen in the X-Z plane, then in that shot, just change the Y component of PlaneConstraintNormal property to 1, and assuming your game happens at Y=0, which should be the case, it’s ready.

Thank you, that works totally fine with Character blueprint type !! and I’m talking about Pawn type which ain’t have any “character movement” component . I’m trying to figure out how add custom one, or even import it somehow for my Pawn

What kind of movement are you using for your Pawn? Are you writing it custom yourself, using physics simulation etc?

Actually you can’t add a CharacterMovement component to any actor, the only way to have one is to use Character actor or one of its children.

Now, aren’t you able to switch to a character instead of a Pawn? Or is it more along the line of being curious on how it can be done manually?

Yes it’s physics simulation and impulses

My pawn is based only on physics simulations and it have no animation nor skeletal mesh, that’s why I can’t use the character blueprint from the beginning :slight_smile:

I’m adapting another approach , I’ve just found a physical constraint component and here’s what I’m gonna do:

-Attach it to my pawn.
-When a pre-defined plane is triggered then it will constraint my pawn movements (I have options for both linear and angular motions)

working on it right now, hope it works :slight_smile:
please give a feedback or what do u think about it ?

EDIT: I’m stuck with a problem, how can I edit the Angular/Linear limits for physical constraint component ? :frowning: