Forum rules - please read before posting.

Animating with Nav Mesh Agent Character

I am working on a 3D Point & Click project, where I am using a Nav Mesh Agent Player Character. I am trying to animate the character climbing onto a car bonnet, then walking up onto the roof (I already have the climbing animation done). However, The character seems to "bounce off" the car and will not perform the climbing animation (it is a trigger parameter in the Animator named ClimbOnto), presumably because of his capsule collider / rigid body setup. 

Observe:https://youtu.be/Gx3whgQ_JDA

Is there some way to disable the character collider until the animation is complete, or some other way of making this work?

Unity 2017.1
AC 1.62.2 (will be updating)

Comments

  • Whee!

    AC's Collision component can be attached to a Collider to make it react to Turn On / Turn Off commands via the Object: Send message Action.  For reference, it can also be found on the Collision Cube prefab type.

    When "Turn Off" is called, it'll deactivate the collider and place it on the Ignore Raycast layer.

    You may need a custom script however, to avoid the layer change and/or change the Is Kinematic field of the Rigidbody.  You can still use the Object: Send message Action for that in order to call a method on your custom script by name.
  • Welp!

    It seems I just needed to alter the animation import settings (XZ, Baked, Centre of Mass instead of Original. It seems like it should be Original to me, but hey-ho) and remove the colliders from the car. Now I just need to figure out how to get the character to walk around on the roof of the car. I think I'll teleport some hidden colliders maybe, and some invisible walls so he can't fall off the car.

    Honestly, the amount of times I've been fooled by those import settings is unreal, hehe. I should be an expert by now. Should.

  • This second issue is actually more of a bastard than I predicted. 

    So, I have the animation playing correctly now; the character climbs onto the car (actually a second, invisible car that has a nav mesh and mesh collider on it).

    What is supposed to happen now, is the character should walk to another marker on the roof of the car, then play another animation. It does not though.

    The issue is that the character model is animated and climbs onto the car, but his capsule collider does not come with him, so he ends up back where he started. I tried to solve this by using a transform action to move the player to the exact point of the marker (after the climb animation has finished), but it doesn't work for some reason.

    I can show the Action list if it would be any help.
  • Please do.  Object: Transform or Object: Teleport?  Any messages in the Console either?

    Does it work if you temporarily skip the animation?
  • edited May 2018
    I tried both Object: Transform and Teleport. Teleport works actually, but I just can't get it to time properly. Basically what I need is a "Wait until finish?" option for Character: Animate Actions (or equivalent thereof).

    Here is my Action List:

    https://imgur.com/a/ja3bfnL
  • Are you using root motion?  That may conflict with the Object: Transform Action - but that Action should only be necessary if you want the movement to occur over time.

    A "Wait until finish? option in your Character: Animate Action is only possible if you call the animation clip to play by name.  As you're instead invoking a Trigger parameter, there's a separation between that change and the effect it actually has - the Action isn't aware of what animation it's actually causing to play.  You could try changing the Method field to Play Custom and play the animation directly - that'll allow you to wait until it's completed.
  • Thanks for the advice, and yes I am using Root Motion.

    However, it seems the best way to avoid the visible "bounce" when teleporting the character into place after animating, is to actually use a second character in the scene that is initially hidden, then teleport the real player character out of the way. Then get the "fake" character to animate, make invisible again, teleport the real one back again.

    It works, but... ye know. Feels a bit hacky.
  • I recently had a similar issue in a non-AC project, where I wanted a character to correctly line up with a door when opening it.  In the end I used Timeline to do it, since I found that you can have an Idle animation follow your main animation, and have it account for any changes made to the character's position due to root motion.
  • That sounds like the exact solution I need. How's the learning curve on Timeline? I hate having to learn new systems when I'm trying to get something done, especially something that initially seems simple.
  • It's not yet as powerful as I'd hoped, but can be useful when you know what it can do.  AC can also dynamically re-map object bindings via its Engine: Control timeline Action.
  • Okay, cheers.
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.