[英]How to get the distance between 2 objects? (LUA)
game:GetService('RunService').RenderStepped:connect(function()
if ENABLED then
local lol = game.Workspace.Zombies:GetChildren()
local me = game.Players.LocalPlayer.Character
for index, lol in pairs(lol) do
if lol:IsA("Model") then
local AIM = lol:FindFirstChild(_G.AIM_AT)
if AIM then
CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
end
end
end
end
end
end)
How to get the distance between "me" and "AIM"? 如何获得“我”和“目标”之间的距离? I've tried everthing.. :/
我尝试了一切..:/
https://developer.roblox.com/articles/Magnitude This is what it says on the wiki, Here is an Exmaple: https://developer.roblox.com/articles/Magnitude这就是它在Wiki上所说的,这是一个范例:
local distance = (part1.Position - part2.Position).magnitude
print(distance) would return the distance (as a value such as int/float) print(distance)将返回距离(以int / float之类的值表示)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.