====== Point A to B movement using lerp ====== In this example, an object will move from point A to point B in N seconds, using interpolation.\\ Let's use the point where the item is used as point A. It moves to the point B (0,1,0) in 4 seconds. === Example data === https://virtualcast.jp/products/027128433fc0305d1131027f25a3ef30d56592d7cc6aaafbfe588c236a3242fd === Unitypackage === {{ :vci:sample:sample_advanced:tutorial_lerp.unitypackage |}} local framevalue = vci.me.Time.TotalSeconds local framestart = 0 local sub = vci.assets.GetTransform("Sub") local pointA = Vector3.__new(0,1,0)--Point A local pointB = Vector3.__new(0,1,0)--Point B local pointnow =Vector3.zero local moveflag = 0 local distance = 0.01 --Stops when the distance is shorter than this function updateAll() if moveflag==1 then framevalue = (vci.me.Time.TotalSeconds-framestart)/4 --Takes 4 seconds to move --Move from pointA to pointB in N seconds, using interpolation pointnow = Vector3.Lerp(pointA,pointB,framevalue) sub.SetLocalPosition(pointnow) if Vector3.Magnitude(sub.GetLocalPosition()-pointB)