Hi all, I’m pretty new to scripting, but have a niche vision i’m trying to accomplish. Game is grid based, so movement works by sent a node out, then moving the character to that node, movement can only be input when transform.position is == to node.position. This has been fine will working on a flat surface, however it’s getting me stumped while trying to incorporate vertical movement. Currently the node gets sent out to a position 1 higher and 1 across, then the player moves diagonally through to there, this looks weird, more like teleporting. I’ve been trying some methods using slerping to change how the player moves to this location, and so far a slerp with a spinning jump provides the best visual look, but i was wondering if you had any better ways to perform this task while keeping the movement method the same.
//jump up ledge
if (Physics.Raycast(transform.position, moveDirection * 1f, 1f, floor)
&& !Physics.Raycast(transform.position + Vector3.up, moveDirection * 1f, 1f))
{
// Lerp the movement towards the target position
movePoint.position += Vector3.up * 3f + moveDirection * 1f; //this used to be Vector3.up * 1f, but the *3f works better with the Slerp.
anim.SetBool("JumpUp", true);
transform.position = Vector3.Slerp(transform.position, targetPosition, 2*MoveSpeedCurrent * Time.deltaTime);
}
//Jump over 1 wide holes
if (Physics.Raycast(transform.position, moveDirection * 1f, 1f, holeJump)
&& Physics.Raycast(transform.position + moveDirection * 1f, moveDirection * 2f + Vector3.down, 2f, floor))
{
movePoint.position += moveDirection * 2f;
anim.SetBool("JumpGap", true);
transform.position = Vector3.Lerp(transform.position, targetPosition, MoveSpeedCurrent * Time.deltaTime);
}