Basically - when you parent the ship and move it even a single inch, :vel()'s Z starts rapidly decreasing until it hits -805.138184, after which it gets stuck, while all the other values stay at 0.
And THEN, when you UNPARENT it, Z goes to -0.
Here's the code where I noticed that.
--@name SubMat Light Effects
--@author The Next Decade
--@model models/slyfo_2/holo_blockblock1.mdl
if SERVER then
Self = ents.self()
MainEngine = {}
SideEngine = {}
SideEngineCap = {}
HoverEngine = {}
Slipstream = {}
function getProps()
local Consts = Self:getConstraints()
m = 0
s = 0
c = 0
h = 0
for i=1, #Consts do
local Cur = Consts[i]
CurMdl = Cur:model()
--printConsole(CurMdlub(-11))
if CurMdlub(-13) == "eng_sq11b.mdl" then
m = m+1
MainEngine[m] = Cur
end
if CurMdlub(-8) == "wd11.mdl" then
s = s+1
SideEngine[s] = Cur
end
if CurMdlub(-9) == "wdc11.mdl" then
c = c+1
SideEngineCap[c] = Cur
end
if CurMdlub(-11) == "eng_p31.mdl" then
h = h+1
HoverEngine[h] = Cur
end
if Cur:class() == "quantum_slipstream_drive" then
Slipstream = Cur
end
end
end
function tablesInfo()
if MainEngine ~= nil then
for i=1,#MainEngine do
printConsole("Num - "..i.." "..MainEngine[i]:model())
end
end
if SideEngine ~= nil then
for i=1,#SideEngine do
printConsole("Num - "..i.." "..SideEngine[i]:model())
end
end
if SideEngineCap ~= nil then
for i=1,#SideEngineCap do
printConsole("Num - "..i.." "..SideEngineCap[i]:model())
end
end
if HoverEngine ~= nil then
for i=1,#HoverEngine do
printConsole("Num - "..i.." "..HoverEngine[i]:model())
end
end
end
function propMaterials()
if MainEngine ~= nil then
MainMts = MainEngine[1]:getMaterials()
SideMts = SideEngine[1]:getMaterials()
CapsMts = SideEngineCap[1]:getMaterials()
HovrMts = HoverEngine[1]:getMaterials()
for i=1, #MainMts do
printConsole(MainMts[i])
end
printConsole("---")
for i=1, #SideMts do
printConsole(SideMts[i])
end
printConsole("---")
for i=1, #CapsMts do
printConsole(CapsMts[i])
end
printConsole("---")
for i=1, #HovrMts do
printConsole(HovrMts[i])
end
printConsole("---_____---")
printConsole(SideEngine[1]:getSubMaterial(2))
printConsole(SideEngine[1]:getSubMaterial(1))
printConsole(SideEngine[1]:getSubMaterial(1))
printConsole(SideEngine[1]:getSubMaterial(1))
end
end
function enginesActive()
local SVel = Self:vel()
--printConsole(SVel)
local SVelAdd = math.floor(SVel[1]+SVel[2]+SVel[3])
--printConsole(SVelAdd)
if SVelAdd ~= 0 then
for i=1,#MainEngine do
MainEngine[i]etSubMaterial(2,"cmats/light")
end
for i=1,#SideEngine do
SideEngine[i]etSubMaterial(2,"cmats/light")
end
for i=1,#HoverEngine do
HoverEngine[i]etSubMaterial(2,"cmats/light")
end
else
for i=1,#MainEngine do
MainEngine[i]etSubMaterial(2,"pyro_overloader/diffuse")
end
for i=1,#SideEngine do
SideEngine[i]etSubMaterial(2,"pyro_overloader/diffuse")
end
for i=1,#HoverEngine do
HoverEngine[i]etSubMaterial(2,"pyro_overloader/diffuse")
end
end
(26-08-2015, 06:35 PM)Person8880 Wrote: That's because parenting makes the physics object sleep and fall down. You should use the parent's velocity, not the child's.
Thank you for that information. Would :getParent() after Self work for that purpose?
Yep, it worked. Just had to add a check so that it doesn't try to get the parent unless it IS parented. Misunderstanding resolved, I think that this thread can be closed up now. Thank you again.