Problem using a position determined from onTrigggerEnter in Update

I am able to set Y axis of the player with simple transform.position, all within onTriggerEnter method, but the motion is step-wise and jerky. So now I am trying to make the motion smooth by putting the transform.position function in an Update method. However, it seems that the values determined by onTriggerEnter method are not accessible in the Update function. If I print the x and z values to console, they contain expected values from onTriggerEnter function, but appear to be 0 when I print to console from the update function.

Any ideas of what I am doing wrong?

I would never call myself a programmer, so assume the worst :slight_smile:

Thanks in advance for any help!

public Transform abc;
void OnTriggerEnter(Collider x)
{
abc=x.gameObject.transform;
}
//then you can get the axis x y z of abc when you want;

ZhongshiLiuAndyLaw - Thanks. I just added the code. Can u suggest the better solution?