Search Unity

Clive the Cat - Tutorial

Discussion in 'Scripting' started by VP_no1, Sep 25, 2022.

  1. VP_no1

    VP_no1

    Joined:
    May 12, 2018
    Posts:
    132
    Hi.

    Hi all. I am trying to make a teleport for Clive the Cat wtih some c# and visual scripting but the teleporting is bad.
    I made a separate method from the one provided and connected with nodes but is not teleporting well from one place to another (I mean not on place). The moving bad is due to a vector3 return method that is in the compiled Grid here:

    Code (CSharp):
    1.         public Vector3 GetCellCenterWorld(Vector3Int position)
    2.         {
    3.             return LocalToWorld(CellToLocalInterpolated(position + GetLayoutCellCenter()));
    4.         }
    Or if I just use transform position in VS instead of a c# Teleport Method, then I cannot move the player anymore.
    I checked if Movement is still valid with the included script and it is. But is not moving at all.
    I do not understand how to debug why the player is not moving after teleporting. It seems to me that I should set the CurrentCell but there is no exposure for this( Im thinking to make it public and set it after the teleport).



    Any idea would help.

    Thank you!
     
    Last edited: Sep 25, 2022
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Please post scripting questions on the Scripting forum or in this case even the 2D forum rather than the General Discussion forum.

    I'll move your post for you.

    Thanks.