Whenever there is an interaction or dialogue, my player character will keep moving in the direction they were moving in once the interaction event starts. I read this might be solvable via the wrapper components, but I'm not exactly sure where to add it into the controller script. Does the onDisable function need to encompass my entire script or just a part added onto the end?
See the Unity documentation on the OnDisable function.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
using System.Collections.Generic;
using UnityEngine;
using InControl;
namespace CMF
{
//Advanced walker controller script;
//This controller is used as a basis for other controller types ('SidescrollerController');
//Custom movement input can be implemented by creating a new script that inherits 'AdvancedWalkerController' and overriding the 'CalculateMovementDirection' function;
public class AdvancedWalkerController : Controller {
void OnDisable()
{
// called when the control is blocked
}
void OnEnable()
{
// called when the control is unblocked
}
Like this? Sorry I'm just not sure exactly how to integrate it into my custom script. I'm assuming I put something in these enable/disable brackets?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
controller.Move(Vector3.zero);
Or to set the velocity of a rigidbody:
rigidbody.velocity = Vector3.zero;
The actual code also depends on how the different variables/fields in the script are named.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!