EditableMesh - weird Offset between Vertex Position and Mesh geometry

Decided to try using Roblox EditableMesh instance to simulate ocean waves and then make a buoyancy system. I created a simple plane mesh and used multiple Gerstner waves to “animate” it.
However when i started working on the buoyancy system, i encountered a very weird issue, best described by a “offset” between the Mesh appearance geometry and what i believe to be the Editable Mesh vertices.

Since i was using RenderStepped() at first, i thought it may be a sort of latency issue in the raycasting or something but when i tried to slow down the process and simply set a parts position to a vertex position, the offset remained.

Any ideas? Any help or insight is appreciated.
Video and my dummy debug code below.

local Newpos = nil
			for i,Setting in self.Waves do
				if Newpos then
					Newpos +=  Gerstner(Position, Setting.Direction :: Vector2, os.clock(), Setting.Speed, Setting.Steepness, Setting.Amplitude, Setting.WaveLength)
				else 
					Newpos =   Gerstner(Position, Setting.Direction :: Vector2, os.clock(), Setting.Speed, Setting.Steepness, Setting.Amplitude, Setting.WaveLength)
					
					break
				end
			end
			if Newpos == nil then
				return
			end

			self.OceanMesh:SetPosition(vertex[1], Newpos)
			
			if j == 1 and i == 1 then
				local part = Instance.new("Part", workspace)
				part.Size = Vector3.new(1,1,1)
				part.Position = self.MeshPart.CFrame:PointToWorldSpace(Newpos) 
				part.Anchored = true
				part.BrickColor = BrickColor.Red()
				game:GetService("Debris"):AddItem(part, 0.1)
				
			end

1 Like