Forum rules - please read before posting.

How to Jump while running or walking

Hello,

It's been a while!

I'm wondering how can I make the character Jump while its running or walking. The effect I'm trying to achieve is simple, he has for example another 10 feet to walk/run towards (point and click), and I want to jump Mid way thrusting the char forward and upward at the same time, and when it lands to continue walking/running to the destination.

Hope there's an easy way to this,

Thanks,

Note: Basically same thing as direct input, you can jump while running etc. I am utilizing this: http://adventure-creator.wikia.com/wiki/Combining_PointAndClick_with_Direct_Movement_Methods In order to have both at the same time.

Comments

  • Likely not easily, since jumping would intefere with the fact that he's pathfinding.  The unofficial script you've linked to does not technically allow for both at the same time - just for the movement method to be changed on the fly.

    Your example case suggests that this would be a pre-planned event, i.e. a specific case.  Is that the situation, or are you looking for something more general?

    If you can explain your exact intentions in the form of screenshots and clearer detail, I can think more about how you might go about it.
  • The levels on the character have 'empty' spaces, thus the character needs to jump on the platforms in order to make it to the other side. (If the player falls it dies)

    The whole game makes a lot more sense to be played with mouse point and click, however the jump is imperative.

    The direct movement method is only in there in case someone wanted to play with a controller.

    I am extremely hopeful that this can be done, otherwise I've no idea how to continue with AC.

    Please shine some bright light

    Thank you for your long continued support
  • I'd recommend you look into Unity's Off-Mesh Link feature, which allows for NavMeshAgents to "jump" between two edges of a baked NavMesh:

    https://docs.unity3d.com/Manual/class-OffMeshLink.html
    https://docs.unity3d.com/Manual/nav-CreateOffMeshLink.html
    https://forum.unity.com/threads/how-to-trigger-a-jump-on-an-offmesh-link.313628/

    AC characters rely on an internal waypoint algorithm by default, but you can have them instead rely on NavMeshAgents by attaching the "NavMeshAgent Integration" component.  It may be that some minor tweaking is necessary, but I'd say Off-Mesh Links are probably your best bet.

    As they're also a Unity feature, it may be best to test with them alone without AC first, and then only look to merge them with AC once they're up and running (and jumping) OK.
  • edited March 2018
    @kici Well, if the jump locations aren't many, you could try turning those jump areas into hotspots/Triggers and use them to run a cutscene or a Timeline. that way you can then do them Zelda style (by pressing a button or doing it automatically for the player). Else I'd try off-mesh links, like Chris said. Or, better, you could use a third party character controller, or code a custom character controller yourself (personally, this last would be my preferred choice, that way you can tweak the looks and specific behavior, but I'm not sure if you are a coder).

    Anyway, I believe just the ActionList system in AC makes the whole package hugely valuable. Dropping the entire asset just because of the character controller doesn't make much sense to me... Plus, point and click jump isn't a very common feature, "platforming" is almost always done entirely through direct input...
  • Thank you both for the great responses.

    @ChrisIceBox I also wanted to allow the player to have more control of when they jump in game, it could be random anywhere. Unity's NavMesh seems like you will not have full control of when the Player can jump.

    @Alverik, you are right AC is definitely too great an asset to drop. It is robut and it seems to support any integration one might want to do with some coding knowledge.

    I will take a look at what other character controller assets I have and see what I can do from there on,

    If you have any 3rd party asset recommendations please let me know,

    Thank you.
  • I still think relying on a NavMeshAgent will get you most of the way there.  A "jumping" feature could easily be added onto the default behaviour by way of a custom script that adds a vertical force - and this could be mapped to an input button if necessary.
  • I have done a script to add force with physics or on its transform to an object, also with playmaker.

    That is no problem, I also have it mapped to the Space button for Jump.

    What I am getting from this now is, I force the character to jump by transform force or physics in the Y direction if player not moving, and Y&Z if moving?

    Also play the Jump animation, and the path-finding will not have any issues?

    I want the player to be able to fall down if they do not jump, and if they do jump to continue if landed properly. Also to be able to jump anytime,


    I will watch all the unity tutorials on their NavMesh and see what I am missing, if you have any more pointers, insights etc I should know much appreciated.

    Thank you for all your help
  • It'll all be down to the custom script that handles the behaviour, but the NavMeshAgent would have been designed with cases like this in mind.  Checking whether or not the character is grounded can be used to have the NavMeshAgent pathfind, vs letting the Rigidbody react to forces.

    The current X/Z velocity of the character can be accounted for when calculating a jump force to apply to them.

    As AC's NavMeshAgentIntegration component is isolated from the rest of AC, you can replace it with a duplicate that you can then tweak as necessary.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.