that function inside the code sample does NOT exist
![]()

Page URL: https://create.roblox.com/docs/reference/engine/classes/EditableMesh#RaycastLocal
that function inside the code sample does NOT exist
![]()

Page URL: https://create.roblox.com/docs/reference/engine/classes/EditableMesh#RaycastLocal
Good luck working with EditableMesh
i tried to make a thing to delete vertices one by one for an animation just to not find removevertex function
A lot of the example code here is leftover from the EditableMesh / EditableImage beta period. EditableMeshes and Images have since been completely reworked with their release. I’ll try to replace the example functions, this is something I’ve been meaning to do for some time.
Call the preferred method :RemoveUnused()
There is no other option since the previous method is deprecated.
The documentation currently makes working with this API an arduous journey. It is an extremely cumbersome experience which is ultimately fruitful and rewarding.
Again, good luck.
Thanks for the report, yeah that example really needed to be updated ![]()
The example on the docsite is being updated, but in the meantime, here is an updated example function that will work:
-- Function that will cast a ray from the given viewport point, returning the world point of the hit and the UV coordinate
local function castRayFromCamera(meshPart : MeshPart, editableMesh : EditableMesh, viewportPoint : Vector3)
if not meshPart then
return
end
-- Calculate how much the object is being scaled in each dimension
local renderScale = meshPart.Size / meshPart.MeshSize
-- Create ray from camera along the direction of a clicked point
local ray = Workspace.CurrentCamera:ViewportPointToRay(viewportPoint.X, viewportPoint.Y)
-- Convert to object space to use with RaycastLocal()
local relativeOrigin = meshPart.CFrame:PointToObjectSpace(ray.Origin) / renderScale
local relativeTarget = meshPart.CFrame:PointToObjectSpace(ray.Origin + ray.Direction * 100) / renderScale
local relativeDirection = relativeTarget - relativeOrigin
local faceId, point, barycentricCoordinate, vertId1, vertId2, vertId3 = editableMesh:RaycastLocal(relativeOrigin, relativeDirection)
if not faceId then
-- Didn't hit any faces
return
end
-- Compute the hit point in world space
local worldHitPoint = meshPart.CFrame:PointToWorldSpace(point * renderScale)
-- Get the UVs on the face
local uvId1 = editableMesh:GetVertexFaceUV(vertId1, faceId)
local uvId2 = editableMesh:GetVertexFaceUV(vertId2, faceId)
local uvId3 = editableMesh:GetVertexFaceUV(vertId3, faceId)
local uv1 = editableMesh:GetUV(uvId1)
local uv2 = editableMesh:GetUV(uvId2)
local uv3 = editableMesh:GetUV(uvId3)
-- Interpolate UVs within the face based on the barycentric coordinate
local u = (barycentricCoordinate.x * uv1.x) + (barycentricCoordinate.y * uv2.x) + (barycentricCoordinate.z * uv3.x)
local v = (barycentricCoordinate.x * uv1.y) + (barycentricCoordinate.y * uv2.y) + (barycentricCoordinate.z * uv3.y)
return worldHitPoint, Vector2.new(u, v)
end
Let me know if you have any questions
Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.