How to get full control of the player's position?

sythe

Member
I need to make the character to "kinda fly" but I can't manually change the transform of the object that contains the controller and also can't make it move to some position through MoveTowards after disabling the gravity, what am I doing wrong?
 
This sounds like the perfect use for a new ability:

 
I don't have an animation for this "flight" the character will stand still. I'm trying to use the ability that you showed but I have some questions

1. I've manually disabled other abilities and market the flight to don't use gravity, but it still going down from cliffs. What am I doing wrong?
1689773747162.png

2. I tried to disable and enable the ability through TryStartAbility but it's returning true on enable and disable. Again, what am I doing wrong? (the flight ability is an empty class that just inherit from Ability)
1689774344408.png

3. I have a state machine that control the inputs, and these input behavior will change depending on current state, normally your system sync with rewired and control the movement, but I want to take this control on some states, the question is, to freely update the player position should I just do it through locomotion.SetPosition(), or I need to do something else?
 
1. I've manually disabled other abilities and market the flight to don't use gravity, but it still going down from cliffs. What am I doing wrong?
It doesn't look like the flight ability is active.

2. I tried to disable and enable the ability through TryStartAbility but it's returning true on enable and disable. Again, what am I doing wrong? (the flight ability is an empty class that just inherit from Ability)
What is returning true? If TryStartAbility returns true then the ability has been started.

3. I have a state machine that control the inputs, and these input behavior will change depending on current state, normally your system sync with rewired and control the movement, but I want to take this control on some states, the question is, to freely update the player position should I just do it through locomotion.SetPosition(), or I need to do something else?
You should not call SetPosition as that will eliminate the continuous movement. You should instead use the ability.

If you have the Swimming Pack the swim ability is a really good example that you can base a flying ability off of. After all, swimming is essentially the same thing as flying from a code perspective.
 
It doesn't look like the flight ability is active.
The ability is enabled on the inspector, does it mean that it is active?

What is returning true? If TryStartAbility returns true then the ability has been started.
My bad, it's returning FALSE on TryStart and TryStop ?‍♂️

You should not call SetPosition as that will eliminate the continuous movement. You should instead use the ability.

If you have the Swimming Pack the swim ability is a really good example that you can base a flying ability off of. After all, swimming is essentially the same thing as flying from a code perspective.
but supposing that I don't want to have an animation, how do I take control of the player position and manually update it?
 
Also an example of this using parachute ability from USC v3 version of parachute is needing a little attention when I get the time, but it is a great example with a bunch of parameters.

Your take control via relative overrides for position and rotation within the ability extension you create.

See some of the examples of how this is done. As Justin has stated, the swim ability pretty much covers flying itself.
My bad, it's returning FALSE on TryStart and TryStop ?‍♂️
If false, check the conditions, not that it will matter when fully hard coded and you know what and when to block etc, but also check that it is not blocked by an ability higher in the list.
 
but my point is that I want to be able to take control over opsive to move, rotate and do other things, are you seeing that the only way to move the character is through animation and overriding properties? For example, my movement controls will not come from an ability extension but through an input state machine
 
The ability is enabled on the inspector, does it mean that it is active?
No, it'll have the (Active) text if it is active.

My bad, it's returning FALSE on TryStart and TryStop ?‍♂️
You can debug this by placing a breakpoint on that line and stepping into the method to determine what part is returning false.

but supposing that I don't want to have an animation, how do I take control of the player position and manually update it?
You don't need an animation. You can still use the ability system.
 
Top