I followed your first suggestion and I got the player to stop at the right distance :) Unfortunately after all the schematics are completed, the player goes back to the original position before the ability started, even if the ability only has 2 Battle Animations: MoveToTarget and BaseAttack (which has no movement functions in it). I even tried adding an extra Stop Battle Animation but it didn't do anything.
Looking at the Debug.Log it looks like after the ability is completed, something keeps calling the Custom Movement Component function MoveTo(speed, position) every frame until the player reaches the original position. I am really not sure how to prevent this...
Try using a Stop Movement node in case you used a Change Position or similar node to move.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Can you post the complete the debug message with the original position (after the action)? That'd show where that call is coming from.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Just in case it might help, this is the code I am using in my Custom Movement Component. using UnityEngine; using TigerForge; using GamingIsLove.Makinom; using GreenEmpire; using System.Collections;
public class ORKCustomMovement : MonoBehaviour { public ORKCustomMovementComponent customComponent = new ORKCustomMovementComponent(); public IMovementComponent _interface; public bool isStopped; //check added to avoid Stop() calls every frame after reaching destination, which was preventing the player to start moving at the beginning of the ability
Uh ... I meant posting the complete error message from one the unrequested returns to position. I.e. select one in the console and copy the whole text that's displayed and paste it here :) The stacktrace that's included in the message will show where that move command is comming from.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Ok, seems to be the Mouse player controls. Might be that disabling the control doesn't clear the move target, I'll check it out :)
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Unfortunately after all the schematics are completed, the player goes back to the original position before the ability started, even if the ability only has 2 Battle Animations: MoveToTarget and BaseAttack (which has no movement functions in it).
I even tried adding an extra Stop Battle Animation but it didn't do anything.
Looking at the Debug.Log it looks like after the ability is completed, something keeps calling the Custom Movement Component function MoveTo(speed, position) every frame until the player reaches the original position.
I am really not sure how to prevent this...
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
This is the Battle Animation schematic I added at the end of the ability to stop the player in place, with the Console Log.
That'd show where that call is coming from.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Just in case it might help, this is the code I am using in my Custom Movement Component.
using UnityEngine;
using TigerForge;
using GamingIsLove.Makinom;
using GreenEmpire;
using System.Collections;
public class ORKCustomMovement : MonoBehaviour
{
public ORKCustomMovementComponent customComponent = new ORKCustomMovementComponent();
public IMovementComponent _interface;
public bool isStopped; //check added to avoid Stop() calls every frame after reaching destination, which was preventing the player to start moving at the beginning of the ability
void Start()
{
_interface = customComponent.Init(this.gameObject);
}
public void MoveTo(float speed, Vector3 position)
{
Debug.Log("ORKCustomMovement method MoveTo() called. GameObject= " + this.gameObject.name + " Destination= " + position.ToString() + " Speed= " + speed.ToString());
EmitEvent_SetSpeed(speed); // calls pathfind method
EmitEvent_SetPosition(position); // call pathfind method
isStopped = false;
}
public void ForceStop()
{
Debug.Log("ORKCustomMovement method ForceStop() called");
EmitEvent_SetPosition(this.gameObject.transform.position); // For debug purposes, if removed the outcome doesn't change
EmitEvent_SetSpeed(0);
isStopped = true;
}
public void Stop()
{
if(!isStopped)
{
Debug.Log("ORKCustomMovement method Stop() called");
EmitEvent_SetPosition(this.transform.position); // For debug purposes, if removed doesn't change the outcome anyways
EmitEvent_SetSpeed(0);
isStopped = true;
}
}
public void SetSpeed(float value)
{
Debug.Log("ORKCustomMovement method SetSpeed() called. Speed= " + value.ToString());
EmitEvent_SetSpeed(value);
}
public void SetDestination(Vector3 position)
{
Debug.Log("ORKCustomMovement method SetDestination() called: " + position.ToString());
EmitEvent_SetPosition(position);
isStopped = false;
}
public void SetPosition(Vector3 position)
{
Debug.Log("ORKCustomMovement method SetPosition() called. Destination= " + position.ToString());
EmitEvent_SetPosition(position);
isStopped = false;
}
public void Move(Vector3 position)
{
Debug.Log("ORKCustomMovement method Move() called. Destination= " + position.ToString());
EmitEvent_SetPosition(position);
isStopped = false;
}
// Code for pathfinding methods
}
The stacktrace that's included in the message will show where that move command is comming from.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
ORKCustomMovement method MoveTo() called. GameObject= Player Destination= (-1.56, 0.22, 2.72) Speed= 5.999989
UnityEngine.Debug:Log (object)
ORKCustomMovement:MoveTo (single,UnityEngine.Vector3) (at Assets/_Main/scripts/ORK/ORKCustomMovement.cs:37)
GamingIsLove.Makinom.ORKCustomMovementComponent/myMoveComponent:MoveTo (UnityEngine.Vector3&,single) (at Assets/_Main/scripts/ORK/ORKCustomMovementComponent.cs:47)
GamingIsLove.ORKFramework.Components.MousePlayerController:Update ()
Might be that disabling the control doesn't clear the move target, I'll check it out :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!