Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modeler's prop stuck fix #119

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions client/modeler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,26 @@ Modeler = {
end,

HoverIn = function (self, data)
self:HoverOut()
local object = data.object
if object == nil then return end
if self.HoverObject then
local tries = 0
while DoesEntityExist(self.HoverObject) do
SetEntityAsMissionEntity(self.HoverObject, true, true)
DeleteEntity(self.HoverObject)
Wait(50)
tries = tries + 1
if tries > 25 then
break
end
end

self.HoverObject = nil
end

local object = data.object and joaat(data.object) or nil
if object == nil then return end
lib.requestModel(object)
self.HoverObject = CreateObject(GetHashKey(object), 0.0, 0.0, 0.0, false, true, false)
if self.HoverObject then return end
self.HoverObject = CreateObject(object, 0.0, 0.0, 0.0, false, false, false)
Modeler.CurrentCameraLookAt = Freecam:GetTarget(self.HoverDistance)
local camRot = Freecam:GetRotation()

Expand All @@ -499,8 +513,19 @@ Modeler = {

HoverOut = function (self)
if self.HoverObject == nil then return end
DeleteEntity(self.HoverObject)
self.HoverObject = nil
if self.HoverObject and self.HoverObject ~= 0 then
local tries = 0
while DoesEntityExist(self.HoverObject) do
SetEntityAsMissionEntity(self.HoverObject, true, true)
DeleteEntity(self.HoverObject)
Wait(50)
tries = tries + 1
if tries > 25 then
break
end
end
self.HoverObject = nil
end
self.IsHovering = false
end,

Expand Down