如何补间相机后面的零件

时间:2019-12-24 02:55:04

标签: lua roblox

我正在尝试制作一个涉及放置物体的游戏。但是,我希望零件/模型与鼠标一起平滑移动,而不是让它在移动后立即与鼠标一起移动。我使用TweenService尝试了几次尝试,但都成功了,但是效率很低,并且使主机落后很多。以下代码可以帮助您:

local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local tweenService = game:GetService("TweenService") --when I tried to use tweenservice

local player = players.LocalPlayer
local mouse = player:GetMouse()

local selected = "Wall" --this usually gets updated automatically when the player clicks a button like Garage but to save you time I avoided adding that in

local repModel = replicatedStorage[selected]

local newModel = repModel:Clone()
newModel.Parent = workspace
mouse.Move:connect(function()
    --where I tried to tween it
    --
    --stuck here
    newModel.PrimaryPart.Position = mouse.Hit.p
end)

0 个答案:

没有答案