Hi all!
Is it possible to check if a player is currently moving?
The issue is I have an action list that runs in background -- and one of the actions is that the player faces an object (A) that the cursor is currently on, and a description pops up.
My issue is that when the player clicks on another object (B) to use, the action list runs for that --> but let's say the user hovers over object (A) for some reason during the time that the player is walking to (B), then the action list for (B) stops, and the player faces (A) instead.
In this case, I want the cursor to work when hovering over (A) , but I don't want to "face object" action running for (A) -- rather, I want to check if the player is moving first, and if so, then don't stop and face object (A)
If they are not moving / are stationary, then facing object (A) is ok!
Any way on how I can achieve this? Thank you!
-- AB
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Through script, yes - IsMovingAlongPath returns True if a character is pathfinding:
Thank you so much!
@ChrisIceBox
Ah -- if it's not too much trouble, would you mind taking a look at my repository? This would be the latest one up on GitHub (updated today) -- the same link I referenced in my other issues.
So for context, I went ahead and added this to a script called "Walk Checker" in the Update() function, and I attached it to my active player prefab (Finley); I am currently testing out the** Instructions scene** in my game.
I also created a global variable called "playerIsMoving" to see if the player is currently moving -- I am then using this variable to determine whether the player should continue moving or stop and look (e.g: see the interaction "Trash Patch: Examine" in the Instructions scene). The variable looks like it is updating correctly, but --
My issue is that it looks like the player is stopping its current movement regardless, despite me setting the interaction to "Run in Background" as opposed to "pause gameplay".
Might you happen to know why the player is still pausing? Relevant information / scenes are included in this post
**tried it out again -- it seems like the action I thought was running was not (the player facing the hotspot of interest), so it looks like that is not an issue / the flow there is correct
However, my player does stop moving which is strange, despite the actionlist running in the background. Is there anyway I can prevent this for this hover action list? I would like the player to continue moving along the path they originally were, as opposed to stopping when hovering over a hotspot.
The Player stops because of the AutoExamineHotspot script running the Hotspot's Examine interaction, which halts the Player.
To get around this, you can bypass the halting, and just run the interaction ActionList directly. In the ucustom script, replace:
with:
Awesome, I think this fixed it! Thank you so much!
When running the examine interaction directly, is it possible to set the parameters as well?
I have "Set Interaction Parameter" components on the object the script is attached to, and I'm hoping that they get set first. It looks like they are not currently, so is there any way to fix this?
That'd need a reversion of the above change - Set Interaction Parameters kicks in when the Hotspot is interacted with, rather than when the Interaction ActionList is run directly.
It might need a different approach - i.e. a "Don't stop Player movement" option in the Hotspot's Inspector. I'll have a think about what might be possible.
Ah no worries!
Is there any kind of workaround I could do for now?
I'm in a bit of a tight place of incorporating beta feedback so I can have something by EOM, so I was just curious to know if there's a way I could have this functionality!
I tried doing this via script today btw, but it seems to be flaky.
It doesn't look like the description is being updated properly from time to time:
The relevant parts is between the "START HERE" and the "END HERE" block.
`using UnityEngine;
using AC;
using UnityEngine.TextCore.Text;
using System.Collections.Generic;
public class AutoExamineHotspot : MonoBehaviour
{
}`
You can view the runtime-generated ActionList in the Editor window as normal - check to see if the Actions are correct there.
I'll incorporate a "Stop movement" option into the interaction options when "Play action" is set to "Do Nothing" in the next release.
Awesome, thank you so much!
Might you happen to know where I can see upcoming release dates?
Will keep my eyes peeled, thank you so much for taking this into account for your next release!
Afraid not - but you're welcome to be involved in testing. Send me a PM if so.
Awesome, thanks!