If i have a point on this rail and the velocity i want to find which attachment to pick (not necessarily closest) that is in the direction of the velocity, but i do not know how to accomplish this
You can try to use raycasting, add part into the attachment you want to find, and send a ray to get the near-like position of the attachment.
1 Like
i dont see how i could get the information i want from just a raycast
You can’t get the attachment’s position with raycasting as it’s not a 3d object, this is why I said you need to put some part to use it
Either you can try to use CFrame.lookAt() to get the attachment’s axis
Im trying to use the direction of the velocity to get the point not raycast
You can try to compare 2 points of space to get the velocity direction
DirectionCFrame = nil
while true do
local OldPosition = part.Position
task.wait()
local NewPosition = part.Position
DirectionCFrame = CFrame.lookAt(OldPosition,NewPosition)
end
Also consider a fact that I don’t know exactly what you script