misha.physics
Well-known member
- Joined
- Dec 22, 2021
- Messages
- 1,480
- Reaction score
- 2,207
- Points
- 128
- Location
- Lviv
- Preferred Pronouns
- he/him
I'm not noticing this issue for the DG (on Lua), but it happens with my custom vessel based on Lua. Maybe there're some problems with my short Lua code or/and with my TD points definitions. I will be glad if someone could test it.
So, I'm starting moving on a runway, then when speed isn't zero (for example ~1 m/s), I press Ctrl F4, then select the Scenario Editor, and the vessel is diving underground. This issue doesn't occur when the vessel is completely stopped. My Lua vessel code example:
I think you can use any of your mesh, just call it "TestVessel.msh" (or change the name in the end of the code).
So, I'm starting moving on a runway, then when speed isn't zero (for example ~1 m/s), I press Ctrl F4, then select the Scenario Editor, and the vessel is diving underground. This issue doesn't occur when the vessel is completely stopped. My Lua vessel code example:
Code:
--[[
; Example for a script-driven vessel class definition.
; For implementation code, see Orbitersdk/samples/ScriptVessel
; This file contains both the configuration and script parts.
; The config part is terminated by 'END_PARSE' to prevent the
; Orbiter parser from reading the script, and enclosed in Lua
; comment brackets to make it a comment for the script interpreter.
; A. Configuration section
; -------------------------------------------
ClassName =TestVessel
Module = ScriptVessel
Script = TestVessel.cfg
END_PARSE
; B. Script section
; -------------------------------------------
--]]
-- Vessel parameters
vprm = { -- general Parameters
emass = 500, -- empty mass [kg]
fuelmass = 750, -- propellant mass [kg]
size = 50, -- mean radius [m]
pmi = {x=10,y=30,z=10}, -- principal moments of inertia [m^2]
cs = {x=10,y=8,z=10}, -- cross sections [m^2]
rd = {x=5,y=0.1,z=5}, -- rotation drag coefficients
co = {x=0,y=0,z=0}, -- cockpit camera offset
td1 = {x=0,y=-12,z=100}, -- touchdown point: front
td2 = {x=-20,y=-12,z=-50}, -- touchdown point: left
td3 = {x=20,y=-12,z=-50} -- touchdown point: right
}
thhovr_prm = { -- hover thruster parameters
pos = {x=0,y=0,z=0}, -- thrust attack point [m]
dir = {x=0,y=1,z=0}, -- thrust direction
maxth0 = 1.5e4, -- max. vacuum thrust [N]
isp0 = 5e5 -- vacuum ISP value [m/s]
}
thrcs_prm = { -- RCS thruster parameters
maxth0 = 2e3, -- max. vaccum thrust [N]
isp0 = 5e4 -- vacuum ISP value [m/s]
}
-- SetClassCaps implementation
function clbk_setclasscaps(cfg)
-- physical vessel parameters
vi:set_size(vprm.size)
vi:set_emptymass(vprm.emass)
vi:set_pmi(vprm.pmi)
vi:set_crosssections(vprm.cs)
vi:set_rotdrag(vprm.rd)
vi:set_touchdownpoints(vprm.td1,vprm.td2,vprm.td3)
-- propellant resources
hProp = vi:create_propellantresource(vprm.fuelmass)
-- hover engine
thhovr_prm.hprop = hProp
thhovr = vi:create_thruster(thhovr_prm)
thghovr = vi:create_thrustergroup({thhovr},THGROUP.HOVER)
-- RCS engines
th = thrcs_prm.maxth0
isp = thrcs_prm.isp0
thrcs0 = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs1 = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs2 = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs3 = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs4 = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs5 = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs6 = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=0,y=1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs7 = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=0,y=-1,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs8 = vi:create_thruster({pos={x=1,y=0,z=3},dir={x=-1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs9 = vi:create_thruster({pos={x=-1,y=0,z=3},dir={x=1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs10 = vi:create_thruster({pos={x=1,y=0,z=-3},dir={x=-1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs11 = vi:create_thruster({pos={x=-1,y=0,z=-3},dir={x=1,y=0,z=0},maxth0=th,isp0=isp,hprop=hProp})
thrcs12 = vi:create_thruster({pos={x=0,y=0,z=-3},dir={x=0,y=0,z=1},maxth0=th,isp0=isp,hprop=hProp})
thrcs13 = vi:create_thruster({pos={x=0,y=0,z=3},dir={x=0,y=0,z=-1},maxth0=th,isp0=isp,hprop=hProp})
vi:create_thrustergroup({thrcs0,thrcs2,thrcs5,thrcs7},THGROUP.ATT_PITCHUP)
vi:create_thrustergroup({thrcs1,thrcs3,thrcs4,thrcs6},THGROUP.ATT_PITCHDOWN)
vi:create_thrustergroup({thrcs0,thrcs4,thrcs3,thrcs7},THGROUP.ATT_BANKLEFT)
vi:create_thrustergroup({thrcs1,thrcs5,thrcs2,thrcs6},THGROUP.ATT_BANKRIGHT)
vi:create_thrustergroup({thrcs8,thrcs11},THGROUP.ATT_YAWLEFT)
vi:create_thrustergroup({thrcs9,thrcs10},THGROUP.ATT_YAWRIGHT)
vi:create_thrustergroup({thrcs8,thrcs10},THGROUP.ATT_LEFT)
vi:create_thrustergroup({thrcs9,thrcs11},THGROUP.ATT_RIGHT)
vi:create_thrustergroup({thrcs12},THGROUP.ATT_FORWARD)
vi:create_thrustergroup({thrcs13},THGROUP.ATT_BACK)
-- camera parameters
vi:set_cameraoffset(vprm.co)
-- associate a mesh for the visual
vi:add_mesh('TestVessel')
vi:set_mesh_visibility_mode(0,MESHVIS.EXTERNAL)
end