Forum rules - please read before posting.

Make character walk to the clicked spot and perform an animation

Hi everyone,

I’m trying to set up a mechanic where the player can click on a random spot on the ground, have the character walk over to that location, and then dig the ground using a shovel.

I’m mainly stuck on getting the character to walk to the clicked location and then trigger the digging animation. What would be the easiest way to achieve this using the Actions available in Adventure Creator?

Thanks in advance for any help!

Comments

  • You mightwant to try a Hotspot and within the hotspot make a marker. Below the marker there is an option for your character to walk to the marker and check the wait until finish marker so your character walks all the way to the desired point (marker) before digging.

    When you are on the hotspot there will be the option on the rightside to create an action list. There you can attach the desired animation from the character you choose.

    The adventure creator manual online may also assist you further.

    Hope this helps.

    -Asuna :)
  • Yes, the easiest way is to just make it a Hotspot and regular Use interaction.

    You can use a simple script to place its Walk-to Marker over the cursor so that the Player walks to the exact point you clicked:

    using UnityEngine;
    using AC;
    
    public class WalkToCursor : MonoBehaviour
    {
    
        public Hotspot hotspot;
    
        void OnEnable() => EventManager.OnHotspotInteract += OnHotspotInteract;
        void OnDisable() => EventManager.OnHotspotInteract -= OnHotspotInteract;
    
        void OnHotspotInteract(Hotspot hotspot, Button button)
        {
            if (this.hotspot == hotspot)
            {
                var mousePosition = KickStarter.playerInput.GetMousePosition();
                var worldPosition = Camera.main.ScreenToWorldPoint(mousePosition);
                hotspot.walkToMarker.Position = worldPosition;
            }
        }
    
    }
    
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.