1.Trying to move on the stair like up and down
2. but avatar is going down, applied below code
'intersect = raycaster.intersectObjects(colliders);'
'if (intersect.length > 0) {'
'const targetY = pos.y - intersect[0].distance;'
'if (targetY > this.object.position.y) {'
//Going up
'this.object.position.y = 0.8 * this.object.position.y + 0.2 * targetY;'
'this.velocityY = 0;'
'} else if (targetY < this.object.position.y) {'
//Falling
'if (this.velocityY == undefined) this.velocityY = 0;'
'this.velocityY += dt * gravity;'
'this.object.position.y -= this.velocityY;'
'if (this.object.position.y < targetY) {'
'this.velocityY = 0;'
'this.object.position.y = targetY;'
'}'
'}'
'}'