update
This commit is contained in:
parent
a81aa450dc
commit
9f19c7d618
5
koptilnya/.idea/.gitignore
generated
vendored
5
koptilnya/.idea/.gitignore
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
12
koptilnya/.idea/koptilnya.iml
generated
12
koptilnya/.idea/koptilnya.iml
generated
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
8
koptilnya/.idea/modules.xml
generated
8
koptilnya/.idea/modules.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/koptilnya.iml" filepath="$PROJECT_DIR$/.idea/koptilnya.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
koptilnya/.idea/vcs.xml
generated
6
koptilnya/.idea/vcs.xml
generated
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name Audi A6 2012
|
--@name Audi A6 2012
|
||||||
-- @author Opti1337, DarkSupah
|
--@author Opti1337, DarkSupah
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
@ -193,10 +193,5 @@ if SERVER then
|
|||||||
|
|
||||||
builder:build("DashDials", Vector(0), Angle(0), SCALE, Colors.DashDials, Materials.DashDials, this, this)
|
builder:build("DashDials", Vector(0), Angle(0), SCALE, Colors.DashDials, Materials.DashDials, this, this)
|
||||||
|
|
||||||
local result = builder:getResult()
|
builder:apply()
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name BMW 850CSi 96
|
--@name BMW 850CSi 96
|
||||||
-- @author Opti1337, DarkSupah
|
--@author Opti1337, DarkSupah
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
|
|
||||||
--@include koptilnya/libs/flux.txt
|
--@include koptilnya/libs/flux.txt
|
||||||
|
|
||||||
local flux = require("koptilnya/libs/flux.txt")
|
local flux = require("koptilnya/libs/flux.txt")
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
local LINK = "http://82.179.248.158/bmw_850csi_96.obj#baaz"
|
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/bmw_850csi_96.obj"
|
||||||
local SCALE = Vector(1)
|
local SCALE = Vector(1)
|
||||||
|
|
||||||
local Materials =
|
local Materials =
|
||||||
@ -129,7 +130,7 @@ if SERVER then
|
|||||||
builder:build("headlightl_black_plastic", Vector(0), Angle(0), SCALE, Colors.BlackPlastic, Materials.BlackPlastic, headlightL, this)
|
builder:build("headlightl_black_plastic", Vector(0), Angle(0), SCALE, Colors.BlackPlastic, Materials.BlackPlastic, headlightL, this)
|
||||||
builder:build("headlightl_chrome", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, headlightL, this)
|
builder:build("headlightl_chrome", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, headlightL, this)
|
||||||
|
|
||||||
local result = builder:getResult()
|
local result = builder:apply()
|
||||||
|
|
||||||
local headlightl = {
|
local headlightl = {
|
||||||
angle = 0
|
angle = 0
|
||||||
@ -140,8 +141,8 @@ if SERVER then
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openHeadlights()
|
function openHeadlights()
|
||||||
flux.to(headlightl, 1, { angle = 28 }):delay(0.3):ease("quartout")
|
flux.to(headlightl, 1, { angle = 2 }):delay(0.3):ease("quartout")
|
||||||
flux.to(headlightr, 1, { angle = 28 }):ease("quartout")
|
flux.to(headlightr, 1, { angle = -2 }):ease("quartout")
|
||||||
end
|
end
|
||||||
|
|
||||||
function closeHeadlights()
|
function closeHeadlights()
|
||||||
@ -165,9 +166,4 @@ if SERVER then
|
|||||||
closeHeadlights()
|
closeHeadlights()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name BMW M4 G82 Competition
|
--@name BMW M4 G82 Competition
|
||||||
-- @author Koptilnya1337
|
--@author Koptilnya1337
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
@ -36,10 +36,5 @@ if SERVER then
|
|||||||
builder:build("Trunk", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
builder:build("Trunk", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
||||||
builder:build("Roof", Vector(0), Angle(0), SCALE, Colors.Carbon, Materials.Carbon, this, this)
|
builder:build("Roof", Vector(0), Angle(0), SCALE, Colors.Carbon, Materials.Carbon, this, this)
|
||||||
|
|
||||||
local result = builder:getResult()
|
builder:apply()
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name Ford Mustang GT 2015
|
--@name Ford Mustang GT 2015
|
||||||
-- @author Opti1337, DarkSupah
|
--@author Opti1337, DarkSupah
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
-- @include /koptilnya/car_systems/lights_controller.txt
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
|
||||||
require("/koptilnya/car_systems/lights_controller.txt")
|
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
@ -50,8 +48,10 @@ local COLORS = {
|
|||||||
local builder = {}
|
local builder = {}
|
||||||
local lightsController = {}
|
local lightsController = {}
|
||||||
|
|
||||||
|
builder = MeshBuilder:new(LINK)
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
builder.onObjectParsed = function(builder, objectsNames)
|
builder.onObjectParsed = function(builder, objectsNames)
|
||||||
printTable(objectsNames)
|
printTable(objectsNames)
|
||||||
end
|
end
|
||||||
@ -91,52 +91,5 @@ if SERVER then
|
|||||||
local HighBeamLights = builder:build("HighBeamLights_body1_model0.017", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
|
local HighBeamLights = builder:build("HighBeamLights_body1_model0.017", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
|
||||||
local FogLights = builder:build("FogLights_body1_model0.018", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
|
local FogLights = builder:build("FogLights_body1_model0.018", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
|
||||||
|
|
||||||
local result = builder:getResult()
|
builder:apply()
|
||||||
|
|
||||||
local lights = {
|
|
||||||
StopLights = {Entities = {LeftStopLight1, LeftStopLight2, LeftStopLight3, RightStopLight1, RightStopLight2, RightStopLight3}, LerpSpeed = 0.2, Colors = {On = Color(250, 0, 0), Off = Color(30, 0, 0), Active = Color(90, 0, 0)}},
|
|
||||||
ReverseLights = {Entities = {ReverseLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
|
|
||||||
LowBeamLights = {Entities = {LowBeamLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
|
|
||||||
HighBeamLights = {Entities = {HighBeamLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
|
|
||||||
FogLights = {Entities = {FogLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}}
|
|
||||||
TurnLights = {LeftEntities = {LeftStopLight1, LeftStopLight2, LeftStopLight3}, RightEntities = {RightStopLight1, RightStopLight2, RightStopLight3}, LerpSpeed = 0.2, Colors = {On = Color(250, 120, 0), Off = Color(30, 0, 0)}}
|
|
||||||
}
|
|
||||||
|
|
||||||
-- local lightsEntities = {StopLights = {StopLights}, ReverseLights = {ReverseLights}, LowBeamLights = {LowBeamLights}, HighBeamLights = {HighBeamLights}}
|
|
||||||
-- local lightColors = {StopLights = {On = Color(250, 0, 0), Off = Color(30, 0, 0), Active = Color(90, 0, 0)}, ReverseLights = {On = Color(255, 255, 255), Off = Color(20, 20, 20), Active = Color(20, 20, 20)}}
|
|
||||||
-- local lights = {Lights = lightsEntities, Colors = lightColors}
|
|
||||||
|
|
||||||
lightsController = LightsController:new(lights)
|
|
||||||
|
|
||||||
wire.adjustPorts({LightInputs = "table"}, {})
|
|
||||||
|
|
||||||
hook.add("think", "lights", function()
|
|
||||||
lightsController:useStopLights(wire.ports.LightInputs.Stop)
|
|
||||||
lightsController:useReverseLights(wire.ports.LightInputs.Reverse)
|
|
||||||
lightsController:useLowBeam(wire.ports.LightInputs.LowBeam)
|
|
||||||
lightsController:useHighBeam(wire.ports.LightInputs.HighBeam)
|
|
||||||
|
|
||||||
lightsController:setActive(wire.ports.LightInputs.LowBeam == 1)
|
|
||||||
|
|
||||||
lightsController:update()
|
|
||||||
end
|
|
||||||
)
|
|
||||||
else
|
|
||||||
function init()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if hasPermission("http.get") and hasPermission("mesh") and hasPermission("entities.setRenderProperty", chip()) then
|
|
||||||
init()
|
|
||||||
else
|
|
||||||
setupPermissionRequest({"http.get", "mesh", "entities.setRenderProperty"}, "", true)
|
|
||||||
|
|
||||||
hook.add("permissionrequest", "_permissionrequest", function()
|
|
||||||
if permissionRequestSatisfied() then
|
|
||||||
init()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name Ford F-150 Raptor
|
--@name Ford F-150 Raptor
|
||||||
-- @author Opti1337, .hemp
|
--@author Opti1337, .hemp
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
@ -50,10 +50,5 @@ if SERVER then
|
|||||||
|
|
||||||
builder:build("Railing", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/trans/wheels/wheel_d_rim1", chip(), chip())
|
builder:build("Railing", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/trans/wheels/wheel_d_rim1", chip(), chip())
|
||||||
|
|
||||||
local result = builder:getResult()
|
builder:apply()
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name JDM Wheels
|
--@name JDM Wheels
|
||||||
-- @author Opti1337, .hemp
|
--@author Opti1337, .hemp
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
|
||||||
|
|
||||||
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/jdmwheel1.obj?d=1"
|
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/jdmwheel1.obj?d=1"
|
||||||
local SCALE = Vector(0.6)
|
local SCALE = Vector(0.6)
|
||||||
@ -63,12 +62,7 @@ if SERVER then
|
|||||||
}, wheel, wheel)
|
}, wheel, wheel)
|
||||||
end
|
end
|
||||||
|
|
||||||
builder:getResult()
|
builder:apply()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name Porsche 911 Turbo S 2017
|
--@name Porsche 911 Turbo S 2017
|
||||||
-- @author Opti1337, DarkSupah
|
--@author Opti1337, DarkSupah
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
@ -11,21 +11,80 @@ local SCALE = Vector(0.9)
|
|||||||
|
|
||||||
local builder = {}
|
local builder = {}
|
||||||
|
|
||||||
|
local objectNames = {"Gear_stick_handle",
|
||||||
|
"Locks",
|
||||||
|
"Left_door_panel",
|
||||||
|
"Seat_base",
|
||||||
|
"Torpedo",
|
||||||
|
"Front_bumper_details",
|
||||||
|
"Dashboard_interior",
|
||||||
|
"Right_door_body",
|
||||||
|
"Body",
|
||||||
|
"Seatbelts",
|
||||||
|
"Seatbelts_caps",
|
||||||
|
"Dials",
|
||||||
|
"Dashboard_panel",
|
||||||
|
"Lower_dashboard",
|
||||||
|
"Rear_mirror",
|
||||||
|
"Dials_base",
|
||||||
|
"Front_lights_glass",
|
||||||
|
"Rear_logo",
|
||||||
|
"Exhaust_pipes",
|
||||||
|
"Torpedo_panel",
|
||||||
|
"Seats",
|
||||||
|
"Dials_glass",
|
||||||
|
"Gear_stick_base",
|
||||||
|
"Bonnet",
|
||||||
|
"Rear_lights_base",
|
||||||
|
"Torpedo_buttons",
|
||||||
|
"Seat_controls",
|
||||||
|
"Carpets",
|
||||||
|
"Steering_wheel",
|
||||||
|
"Interior_base",
|
||||||
|
"Front_bumper",
|
||||||
|
"Front_lights_bulbs",
|
||||||
|
"Doors_rubbers",
|
||||||
|
"Bottom",
|
||||||
|
"Seatbelts_caps_plastic",
|
||||||
|
"Windows_lines",
|
||||||
|
"Exterior_plastic",
|
||||||
|
"Front_lights_strips",
|
||||||
|
"Gear_stick_details",
|
||||||
|
"Exhaust_collector",
|
||||||
|
"Left_door_mirror",
|
||||||
|
"Dashboard_vents",
|
||||||
|
"Dashboard_plastic",
|
||||||
|
"Seatbelts_locks",
|
||||||
|
"Right_door_panel",
|
||||||
|
"Left_door_body",
|
||||||
|
"Right_door_mirror",
|
||||||
|
"Rear_lights_glass",
|
||||||
|
"Stitches",
|
||||||
|
"Right_front_turn",
|
||||||
|
"Timer",
|
||||||
|
"Front_lights_borders",
|
||||||
|
"Front_indicators_glass",
|
||||||
|
"Door_frames",
|
||||||
|
"Front_lights_base",
|
||||||
|
"Left_front_turn",
|
||||||
|
"Rear_details",
|
||||||
|
"Rear_spoiler_glass",
|
||||||
|
"Clothes_hooks",
|
||||||
|
"Exhaust_bumper",
|
||||||
|
"Left_side_indicator",
|
||||||
|
"Dashboard",
|
||||||
|
"Door_plastic",
|
||||||
|
"Rear_bumper",
|
||||||
|
"Seats_plastic",
|
||||||
|
"Right_side_indicator",
|
||||||
|
"Steering_wheel_details"}
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
builder = MeshBuilder:new(LINK)
|
builder = MeshBuilder:new(LINK)
|
||||||
builder.onObjectParsed = function(builder, objectsNames)
|
for k, v in pairs(objectNames) do
|
||||||
timer.simple(3, function()
|
|
||||||
for k, v in pairs(objectsNames) do
|
|
||||||
|
|
||||||
builder:build(v, Vector(0), Angle(0), SCALE, Color(360 / #objectsNames * k, 1, 1):hsvToRGB(), "models/debug/debugwhite", chip(), chip())
|
builder:build(v, Vector(0), Angle(0), SCALE, Color(360 / #objectNames * k, 1, 1):hsvToRGB(), "models/debug/debugwhite", chip(), chip())
|
||||||
end
|
end
|
||||||
|
|
||||||
local result = builder:getResult()
|
builder:apply()
|
||||||
end)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
PERMA.onPermissionsGained = function()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
end
|
|
||||||
PERMA.build()
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
-- @shared
|
--@shared
|
||||||
-- @name Toyota Altezza
|
--@name Toyota Altezza
|
||||||
-- @author Opti1337, .hemp
|
--@author Opti1337, .hemp
|
||||||
-- @include /koptilnya/mesh_loader/builder.txt
|
--@include /libs/meshbuilder.txt
|
||||||
require("/koptilnya/mesh_loader/builder.txt")
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
||||||
|
|
||||||
DEBUG_MODE = true
|
DEBUG_MODE = true
|
||||||
|
|
||||||
local LINK = "https://www.dropbox.com/s/0vnd3nir8cyolz5/is300_3.obj?dl=1"
|
local LINK = "https://www.dropbox.com/s/0vnd3nir8cyolz5/is300_3.obj?dl=1"
|
||||||
local SCALE = Vector(0.8, 0.79, 0.8)
|
local SCALE = Vector(0.8, 0.79, 0.8)
|
||||||
|
|
||||||
local builder = {}
|
local builder = MeshBuilder:new(LINK)
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
|
|
||||||
builder:build("body_Mesh_0", Vector(0), Angle(0), SCALE, Color(40, 40, 40), "models/debug/debugwhite", chip(), chip())
|
builder:build("body_Mesh_0", Vector(0), Angle(0), SCALE, Color(40, 40, 40), "models/debug/debugwhite", chip(), chip())
|
||||||
builder:build("chrome_Mesh_1", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_chrome", chip(), chip())
|
builder:build("chrome_Mesh_1", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_chrome", chip(), chip())
|
||||||
@ -24,33 +24,5 @@ if SERVER then
|
|||||||
builder:build("Reshetka_Mesh_7", Vector(0), Angle(0), SCALE, Color(225, 255, 255, 255), "models/props_interiors/metalfence007a", chip(), chip())
|
builder:build("Reshetka_Mesh_7", Vector(0), Angle(0), SCALE, Color(225, 255, 255, 255), "models/props_interiors/metalfence007a", chip(), chip())
|
||||||
builder:build("w_plastic_Mesh_8", Vector(0), Angle(0), SCALE, Color(225, 255, 255, 255), "models/combine_scanner/scanner_eye", chip(), chip())
|
builder:build("w_plastic_Mesh_8", Vector(0), Angle(0), SCALE, Color(225, 255, 255, 255), "models/combine_scanner/scanner_eye", chip(), chip())
|
||||||
|
|
||||||
builder:getResult()
|
builder:apply()
|
||||||
else
|
|
||||||
function init()
|
|
||||||
builder = MeshBuilder:new(LINK)
|
|
||||||
builder.onHologramsReceived = function(builder, objects)
|
|
||||||
local mat = material.create("VertexLitGeneric")
|
|
||||||
mat:setTextureURL("$basetexture", "https://i.imgur.com/gw4kfYv.jpg",
|
|
||||||
function(m, url, w, h, layout)
|
|
||||||
layout(0, 0, 2048, 2048)
|
|
||||||
end,
|
|
||||||
function(m, url)
|
|
||||||
objects[1].holo:setMaterial("")
|
|
||||||
objects[1].holo:setMeshMaterial(m)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if hasPermission("http.get") and hasPermission("mesh") and hasPermission("entities.setRenderProperty", chip()) then
|
|
||||||
init()
|
|
||||||
else
|
|
||||||
setupPermissionRequest({"http.get", "mesh", "entities.setRenderProperty"}, "", true)
|
|
||||||
|
|
||||||
hook.add("permissionrequest", "_permissionrequest", function()
|
|
||||||
if permissionRequestSatisfied() then
|
|
||||||
init()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,13 +8,12 @@ local Vehicle, POWERTRAIN_COMPONENT = unpack(require('/koptilnya/engine_remaster
|
|||||||
local Differential = require('/koptilnya/engine_remastered/powertrain/differential.txt')
|
local Differential = require('/koptilnya/engine_remastered/powertrain/differential.txt')
|
||||||
|
|
||||||
local WheelConfig = {
|
local WheelConfig = {
|
||||||
BrakePower = 800,
|
BrakePower = 1200,
|
||||||
CustomWheel = {},
|
CustomWheel = { Mass = 80 },
|
||||||
Model = 'models/sprops/trans/wheel_d/t_wheel25.mdl',
|
Model = 'models/sprops/trans/wheel_d/t_wheel25.mdl'
|
||||||
RotationAxle = Angle(1, 0, 0)
|
|
||||||
}
|
}
|
||||||
local FrontWheelsConfig = table.merge(table.copy(WheelConfig), { SteerLock = 35 })
|
local FrontWheelsConfig = table.merge(table.copy(WheelConfig), { SteerLock = 33, CustomWheel = { Mass = 80, CasterAngle = 7 } })
|
||||||
local RearWheelsConfig = table.merge(table.copy(WheelConfig), { HandbrakePower = 2000 })
|
local RearWheelsConfig = table.merge(table.copy(WheelConfig), { HandbrakePower = 2200 })
|
||||||
|
|
||||||
Vehicle:new({
|
Vehicle:new({
|
||||||
{
|
{
|
||||||
@ -58,12 +57,31 @@ Vehicle:new({
|
|||||||
Reverse = 3.437
|
Reverse = 3.437
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name = 'AxleFront',
|
||||||
|
Type = POWERTRAIN_COMPONENT.Differential,
|
||||||
|
Config = {
|
||||||
|
SteerLock = 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = 'WheelFL',
|
||||||
|
Type = POWERTRAIN_COMPONENT.Wheel,
|
||||||
|
Input = 'AxleFront',
|
||||||
|
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 0 })
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = 'WheelFR',
|
||||||
|
Type = POWERTRAIN_COMPONENT.Wheel,
|
||||||
|
Input = 'AxleFront',
|
||||||
|
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 180 })
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name = 'Axle1',
|
Name = 'Axle1',
|
||||||
Input = 'Gearbox',
|
Input = 'Gearbox',
|
||||||
Type = POWERTRAIN_COMPONENT.Differential,
|
Type = POWERTRAIN_COMPONENT.Differential,
|
||||||
Config = {
|
Config = {
|
||||||
Type = Differential.TYPES.HLSD,
|
Type = Differential.TYPES.Open,
|
||||||
FinalDrive = 3.392,
|
FinalDrive = 3.392,
|
||||||
Inertia = 0.01,
|
Inertia = 0.01,
|
||||||
BiasAB = 0.5,
|
BiasAB = 0.5,
|
||||||
@ -73,25 +91,15 @@ Vehicle:new({
|
|||||||
SlipTorque = 1000
|
SlipTorque = 1000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name = 'WheelFL',
|
|
||||||
Input = 'Axle1',
|
|
||||||
Type = POWERTRAIN_COMPONENT.Wheel,
|
|
||||||
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 0 })
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name = 'WheelFR',
|
|
||||||
Input = 'Axle1',
|
|
||||||
Type = POWERTRAIN_COMPONENT.Wheel,
|
|
||||||
Config = table.merge(table.copy(FrontWheelsConfig), { Offset = 180 })
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name = 'WheelRL',
|
Name = 'WheelRL',
|
||||||
|
Input = 'Axle1',
|
||||||
Type = POWERTRAIN_COMPONENT.Wheel,
|
Type = POWERTRAIN_COMPONENT.Wheel,
|
||||||
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 0 })
|
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 0 })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name = 'WheelRR',
|
Name = 'WheelRR',
|
||||||
|
Input = 'Axle1',
|
||||||
Type = POWERTRAIN_COMPONENT.Wheel,
|
Type = POWERTRAIN_COMPONENT.Wheel,
|
||||||
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 180 })
|
Config = table.merge(table.copy(RearWheelsConfig), { Offset = 180 })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
-- @name SX 240
|
--@name SX 240
|
||||||
-- @author Koptilnya1337
|
--@author Koptilnya1337
|
||||||
-- @server
|
--@server
|
||||||
-- @include /koptilnya/engine_remastered/vehicle.txt
|
--@include /koptilnya/engine_remastered/vehicle.txt
|
||||||
require('/koptilnya/engine_remastered/vehicle.txt')
|
require('/koptilnya/engine_remastered/vehicle.txt')
|
||||||
|
|
||||||
Vehicle:new({
|
Vehicle:new({
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
--@include /koptilnya/libs/constants.txt
|
--@include /koptilnya/libs/constants.txt
|
||||||
--@include ./powertrain_component.txt
|
--@include ./powertrain_component.txt
|
||||||
|
|
||||||
|
|
||||||
local PowertrainComponent = require('./powertrain_component.txt')
|
local PowertrainComponent = require('./powertrain_component.txt')
|
||||||
local WheelComponent = require('./wheel.txt')
|
local WheelComponent = require('./wheel.txt')
|
||||||
|
|
||||||
@ -29,6 +28,9 @@ function Differential:initialize(vehicle, name, config)
|
|||||||
self.stiffness = config.Stiffness or 0.1
|
self.stiffness = config.Stiffness or 0.1
|
||||||
self.slipTorque = config.SlipTorque or 1000
|
self.slipTorque = config.SlipTorque or 1000
|
||||||
self.splitStrategy = Differential.getSplitStrategy(config.Type or Differential.TYPES.Open)
|
self.splitStrategy = Differential.getSplitStrategy(config.Type or Differential.TYPES.Open)
|
||||||
|
|
||||||
|
self.steerLock = config.SteerLock or 0
|
||||||
|
self.steerAngle = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function Differential:linkComponent(component)
|
function Differential:linkComponent(component)
|
||||||
@ -107,6 +109,40 @@ function Differential:forwardStep(torque, inertia)
|
|||||||
tqA = self.outputA:forwardStep(tqA, inertia * 0.5 * math.pow(self.finalDrive, 2) + aI) / self.finalDrive
|
tqA = self.outputA:forwardStep(tqA, inertia * 0.5 * math.pow(self.finalDrive, 2) + aI) / self.finalDrive
|
||||||
tqB = self.outputB:forwardStep(tqB, inertia * 0.5 * math.pow(self.finalDrive, 2) + bI) / self.finalDrive
|
tqB = self.outputB:forwardStep(tqB, inertia * 0.5 * math.pow(self.finalDrive, 2) + bI) / self.finalDrive
|
||||||
|
|
||||||
|
-- // REFACTOR
|
||||||
|
if self.steerLock ~= 0 then
|
||||||
|
local steerInertia = (aI + bI) / 2
|
||||||
|
local inputForce = 228.0
|
||||||
|
local maxSteerSpeed = math.rad(1337)
|
||||||
|
|
||||||
|
local inputTorque = self.vehicle.steer * inputForce
|
||||||
|
|
||||||
|
local avgSteerAngle = (self.outputA.customWheel.steerAngle + self.outputB.customWheel.steerAngle) / 2
|
||||||
|
local mz = self.outputA.customWheel.mz + self.outputB.customWheel.mz
|
||||||
|
local avgMz = (self.outputA.customWheel.mz + self.outputB.customWheel.mz) / 2
|
||||||
|
local maxMz = math.max(self.outputA.customWheel.mz + self.outputB.customWheel.mz)
|
||||||
|
local steerTorque = mz * -1 + inputTorque
|
||||||
|
|
||||||
|
local steerAngularAccel = steerTorque / steerInertia
|
||||||
|
|
||||||
|
self.steerAngle = math.clamp(
|
||||||
|
self.steerAngle + steerAngularAccel * TICK_INTERVAL,
|
||||||
|
-self.steerLock,
|
||||||
|
self.steerLock
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Аккерман
|
||||||
|
local wheelbase = 2.05
|
||||||
|
local trackWidth = 1.124
|
||||||
|
local radius = wheelbase / math.tan(math.rad(self.steerAngle))
|
||||||
|
|
||||||
|
local innerAngle = math.deg(math.atan(wheelbase / (radius - (trackWidth / 2))))
|
||||||
|
local outerAngle = math.deg(math.atan(wheelbase / (radius + (trackWidth / 2))))
|
||||||
|
|
||||||
|
self.outputA.customWheel.steerAngle = outerAngle
|
||||||
|
self.outputB.customWheel.steerAngle = innerAngle
|
||||||
|
end
|
||||||
|
|
||||||
return (tqA + tqB) / self.finalDrive
|
return (tqA + tqB) / self.finalDrive
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -55,10 +55,24 @@ function Wheel:initialize(vehicle, name, config)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local right = self.entity:getRight()
|
local right = self.entity:getRight():getRotated(Angle(0, 90, 0))
|
||||||
local offsetRight = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), self.offset)
|
local offsetRight = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), self.offset)
|
||||||
|
|
||||||
self.dir = right:dot(offsetRight)
|
self.dir = right:dot(offsetRight)
|
||||||
|
|
||||||
|
self.debugHolo1 = holograms.create(
|
||||||
|
Vector(),
|
||||||
|
Angle(),
|
||||||
|
'models/sprops/geometry/sphere_3.mdl'
|
||||||
|
)
|
||||||
|
|
||||||
|
self.debugHolo2 = holograms.create(
|
||||||
|
Vector(),
|
||||||
|
Angle(),
|
||||||
|
'models/sprops/geometry/sphere_3.mdl'
|
||||||
|
)
|
||||||
|
|
||||||
|
self.steerVelocity = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function Wheel:getEntityRadius()
|
function Wheel:getEntityRadius()
|
||||||
@ -79,8 +93,10 @@ function Wheel:createHolo(entity)
|
|||||||
entity:getAngles() + Angle(0, self.offset, 0),
|
entity:getAngles() + Angle(0, self.offset, 0),
|
||||||
self.CONFIG.Model or ''
|
self.CONFIG.Model or ''
|
||||||
)
|
)
|
||||||
|
|
||||||
holo:setParent(entity)
|
holo:setParent(entity)
|
||||||
|
|
||||||
|
-- holo:setColor(Color(255,255,255,110))
|
||||||
entity:setColor(Color(0,0,0,0))
|
entity:setColor(Color(0,0,0,0))
|
||||||
|
|
||||||
return holo
|
return holo
|
||||||
@ -105,7 +121,7 @@ function Wheel:forwardStep(torque, inertia)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self.customWheel.steerAngle = self.vehicle.steer * self.steerLock
|
-- self.customWheel.steerAngle = self.vehicle.steer * self.steerLock
|
||||||
--self.customWheel.inertia = inertia
|
--self.customWheel.inertia = inertia
|
||||||
--self.customWheel:setInertia(inertia)
|
--self.customWheel:setInertia(inertia)
|
||||||
self.customWheel.motorTorque = torque
|
self.customWheel.motorTorque = torque
|
||||||
@ -115,19 +131,39 @@ function Wheel:forwardStep(torque, inertia)
|
|||||||
|
|
||||||
self.angularVelocity = self.customWheel.angularVelocity
|
self.angularVelocity = self.customWheel.angularVelocity
|
||||||
|
|
||||||
|
self.debugHolo1:setPos(self.entity:localToWorld(Vector(0, 0, -self.entity:getModelRadius())))
|
||||||
|
|
||||||
if self.customWheel.hasHit and isValid(self.vehicle.basePhysObject) then
|
if self.customWheel.hasHit and isValid(self.vehicle.basePhysObject) then
|
||||||
local surfaceForceVector = self.customWheel.right * self.customWheel.sideFriction.force + self.customWheel.forward * self.customWheel.forwardFriction.force
|
local surfaceForceVector = self.customWheel.right * self.customWheel.sideFriction.force + self.customWheel.forward * self.customWheel.forwardFriction.force
|
||||||
|
|
||||||
self.vehicle.basePhysObject:applyForceOffset(surfaceForceVector, self.entity:getPos() - Vector(0, 0, self.customWheel.radius))
|
self.vehicle.basePhysObject:applyForceOffset(surfaceForceVector, self.entity:localToWorld(Vector(0, 0, -self.entity:getModelRadius())))
|
||||||
end
|
end
|
||||||
|
|
||||||
if isValid(self.holo) then
|
if isValid(self.holo) then
|
||||||
self.rot = self.rot + math.deg(self.angularVelocity) * TICK_INTERVAL * self.dir
|
|
||||||
|
|
||||||
local steerAngle = self.entity:localToWorldAngles(Angle(0, self.offset - self.customWheel.steerAngle, 0) + self.rotationAxle * self.rot)
|
local spinAxis = self.customWheel.up:cross(self.customWheel.forward):getNormalized()
|
||||||
local angle = steerAngle
|
|
||||||
|
|
||||||
self.holo:setAngles(angle)
|
self.debugHolo2:setPos(self.entity:localToWorld(self.customWheel.up * math.sin(timer.curtime()) * 20))
|
||||||
|
|
||||||
|
local rotatedForwardAngle = self.customWheel.forward:getAngle() + Angle(0, 90, 0)
|
||||||
|
|
||||||
|
|
||||||
|
-- self.holo:setAngles(rotatedForwardAngle)
|
||||||
|
|
||||||
|
|
||||||
|
-- local ang = up:getAngle()
|
||||||
|
-- self.holo:setAngles(self.customWheel.forward:getAngle())
|
||||||
|
|
||||||
|
-- self.holo:setAngles(self.holo:getAngles():rotateAroundAxis(self.customWheel.right, 0))
|
||||||
|
-- self.holo:setAngles(self.holo:getAngles():rotateAroundAxis(self.customWheel.right, nil, self.angularVelocity * TICK_INTERVAL))
|
||||||
|
|
||||||
|
|
||||||
|
self.holo:setAngles(self.holo:getAngles():rotateAroundAxis(self.customWheel.right, nil, self.angularVelocity * TICK_INTERVAL))
|
||||||
|
|
||||||
|
-- local steerAngle = self.entity:localToWorldAngles(Angle(0, self.offset - self.customWheel.steerAngle, 0) + self.rotationAxle * self.rot)
|
||||||
|
-- local angle = steerAngle
|
||||||
|
|
||||||
|
-- self.holo:setAngles(angle)
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.customWheel.counterTorque
|
return self.customWheel.counterTorque
|
||||||
|
|||||||
@ -63,7 +63,7 @@ function Vehicle:linkComponents()
|
|||||||
for _, componentConfig in pairs(self.config) do
|
for _, componentConfig in pairs(self.config) do
|
||||||
local component = self:getComponentByName(componentConfig.Name)
|
local component = self:getComponentByName(componentConfig.Name)
|
||||||
|
|
||||||
if componentConfig.Type == POWERTRAIN_COMPONENT.Wheel and componentConfig.Input == nil then
|
if componentConfig.Input == nil && component ~= self:getRootComponent() then
|
||||||
table.insert(self.independentComponents, component)
|
table.insert(self.independentComponents, component)
|
||||||
else
|
else
|
||||||
local inputComponent = self:getComponentByName(componentConfig.Input)
|
local inputComponent = self:getComponentByName(componentConfig.Input)
|
||||||
|
|||||||
@ -14,9 +14,10 @@ function Wheel:initialize(config)
|
|||||||
|
|
||||||
self.mass = config.Mass or 20
|
self.mass = config.Mass or 20
|
||||||
self.radius = config.Radius or 0.27
|
self.radius = config.Radius or 0.27
|
||||||
self.rollingResistance = config.RollingResistance or 40
|
self.rollingResistance = config.RollingResistance or 20
|
||||||
self.squat = config.Squat or 0.1
|
self.squat = config.Squat or 0.1
|
||||||
self.slipCircleShape = config.SlipCircleShape or 1.05
|
self.slipCircleShape = config.SlipCircleShape or 1.05
|
||||||
|
self.casterAngle = math.rad(config.CasterAngle or 0)
|
||||||
|
|
||||||
self.forwardFriction = Friction:new(config.ForwardFriction)
|
self.forwardFriction = Friction:new(config.ForwardFriction)
|
||||||
self.sideFriction = Friction:new(config.SideFriction)
|
self.sideFriction = Friction:new(config.SideFriction)
|
||||||
@ -35,6 +36,7 @@ function Wheel:initialize(config)
|
|||||||
|
|
||||||
self.forward = Vector(0)
|
self.forward = Vector(0)
|
||||||
self.right = Vector(0)
|
self.right = Vector(0)
|
||||||
|
self.up = Vector(0)
|
||||||
self.entity = NULL_ENTITY
|
self.entity = NULL_ENTITY
|
||||||
self.physObj = nil
|
self.physObj = nil
|
||||||
self.baseInertia = 0.5 * self.mass * math.pow(self.radius, 2)
|
self.baseInertia = 0.5 * self.mass * math.pow(self.radius, 2)
|
||||||
@ -168,73 +170,26 @@ function Wheel:slipCircle(Sx, Sy, Fx, Fy, slipCircleShape)
|
|||||||
return Sx, Sy, Fx, Fy
|
return Sx, Sy, Fx, Fy
|
||||||
end
|
end
|
||||||
|
|
||||||
function Wheel:selfAligningTorque(Vx, Vy, Lc)
|
function Wheel:selfAligningTorque(Sy, load)
|
||||||
local VxAbs = math.abs(Vx)
|
if math.abs(Sy) < 0.001 or load < 0.001 then
|
||||||
local Sy = 0
|
|
||||||
|
|
||||||
if VxAbs > 0.3 then
|
|
||||||
Sy = math.deg(math.atan(Vy / VxAbs))
|
|
||||||
else
|
|
||||||
Sy = Vy * (0.003 / TICK_INTERVAL)
|
|
||||||
end
|
|
||||||
|
|
||||||
Sy = math.clamp(Sy, -90, 90)
|
|
||||||
--local phi = (1 - self.E) * Sy + (self.E / self.B) * math.atan(self.B * Sy)
|
|
||||||
--local Mz = -slipSign * self.satFrictionPreset:evaluate(math.abs(phi), self.B, C, self.D, 0) * Lc
|
|
||||||
|
|
||||||
return self.satFrictionPreset:evaluate(math.abs(Sy)) * -math.sign(Sy)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Wheel:selfAligningTorque2(Vx, Vy, Fz)
|
|
||||||
|
|
||||||
if Fz == 0 then
|
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local VxAbs = math.abs(Vx)
|
local B = self.satFrictionPreset.B
|
||||||
local Sy = 0
|
local C = self.satFrictionPreset.C
|
||||||
|
local D = self.satFrictionPreset.D
|
||||||
|
local E = self.satFrictionPreset.E
|
||||||
|
|
||||||
if VxAbs > 0.3 then
|
local loadScale = load * 1000
|
||||||
Sy = math.deg(math.atan(Vy / VxAbs))
|
local mechanicalTrail = 0.15
|
||||||
else
|
local casterEffect = math.tan(self.casterAngle)
|
||||||
Sy = Vy * (0.003 / TICK_INTERVAL)
|
local effectiveTrail = mechanicalTrail + casterEffect * self.radius
|
||||||
end
|
local D_scaled = D * loadScale * effectiveTrail
|
||||||
|
|
||||||
Sy = math.clamp(Sy, -1, 1)
|
local term = B * Sy - E * (B * Sy - math.atan(B * Sy))
|
||||||
|
local Mz = D_scaled * math.sin(C * math.atan(term))
|
||||||
|
|
||||||
local a = {
|
return Mz
|
||||||
-2.72,
|
|
||||||
-2.28,
|
|
||||||
-1.86,
|
|
||||||
-2.73,
|
|
||||||
0.110,
|
|
||||||
-0.070,
|
|
||||||
0.643,
|
|
||||||
-4.04,
|
|
||||||
0.015,
|
|
||||||
-0.066,
|
|
||||||
0.945,
|
|
||||||
0.030,
|
|
||||||
0.070
|
|
||||||
}
|
|
||||||
local FzSqr = math.pow(Fz, 2)
|
|
||||||
|
|
||||||
local C = 2.4
|
|
||||||
local D = a[1] * FzSqr + a[2] * Fz
|
|
||||||
local BCD = (a[3] * FzSqr + a[4] * Fz) / math.pow(math.exp(1), a[5] * Fz)
|
|
||||||
local B = BCD / (C * D)
|
|
||||||
local E = a[6] * FzSqr + a[7] * Fz + a[8]
|
|
||||||
|
|
||||||
local phi = (1 - E) * Sy + (E / B) * math.atan(B * Sy)
|
|
||||||
self.phi = phi
|
|
||||||
|
|
||||||
return D * math.sin(C * math.atan(B * phi))
|
|
||||||
end
|
|
||||||
|
|
||||||
function Wheel:selfAligningTorque3(Mx, My, Sx, Sy)
|
|
||||||
local M = Mx * math.cos(Sy) + My * math.cos(Sx)
|
|
||||||
|
|
||||||
return self.radius * M
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Wheel:update()
|
function Wheel:update()
|
||||||
@ -251,10 +206,27 @@ function Wheel:update()
|
|||||||
self.longitudinalLoadCoefficient = self:getLongitudinalLoadCoefficient(self.load * 1000)
|
self.longitudinalLoadCoefficient = self:getLongitudinalLoadCoefficient(self.load * 1000)
|
||||||
self.lateralLoadCoefficient = self:getLateralLoadCoefficient(self.load * 1000)
|
self.lateralLoadCoefficient = self:getLateralLoadCoefficient(self.load * 1000)
|
||||||
|
|
||||||
--self.steerAngle = self.steerAngle + self.mz / self.inertia
|
local baseForward = self.entity:getForward()
|
||||||
|
local baseUp = self.entity:getUp()
|
||||||
|
local baseRight = self.entity:getRight()
|
||||||
|
|
||||||
self.forward = self.entity:getForward():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
local steerRotatedForward = baseForward:rotateAroundAxis(baseUp, -self.steerAngle)
|
||||||
self.right = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
local finalForward = steerRotatedForward:rotateAroundAxis(baseRight, nil, self.casterAngle)
|
||||||
|
|
||||||
|
self.forward = finalForward:getNormalized()
|
||||||
|
self.right = baseUp:cross(self.forward):getNormalized()
|
||||||
|
self.up = self.forward:cross(self.right):getNormalized()
|
||||||
|
|
||||||
|
|
||||||
|
-- local steerRotated = self.entity:getForward():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
||||||
|
-- self.forward = steerRotated:rotateAroundAxis(self.entity:getRight(), self.casterAngle)
|
||||||
|
|
||||||
|
|
||||||
|
-- local steerRotatedRight = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
||||||
|
-- self.right = steerRotatedRight:rotateAroundAxis(self.entity:getRight(), self.casterAngle)
|
||||||
|
|
||||||
|
-- self.forward = self.entity:getForward():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
||||||
|
-- self.right = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), -self.steerAngle)
|
||||||
|
|
||||||
local forwardSpeed = 0
|
local forwardSpeed = 0
|
||||||
local sideSpeed = 0
|
local sideSpeed = 0
|
||||||
@ -272,16 +244,16 @@ function Wheel:update()
|
|||||||
self.longitudinalLoadCoefficient,
|
self.longitudinalLoadCoefficient,
|
||||||
self.radius,
|
self.radius,
|
||||||
self.inertia,
|
self.inertia,
|
||||||
0.95, -- Force coeff
|
0.95,
|
||||||
0.9 -- Slip coeff
|
0.9
|
||||||
)
|
)
|
||||||
|
|
||||||
local Sy, Fy = self:stepLateral(
|
local Sy, Fy = self:stepLateral(
|
||||||
forwardSpeed,
|
forwardSpeed,
|
||||||
sideSpeed,
|
sideSpeed,
|
||||||
self.lateralLoadCoefficient,
|
self.lateralLoadCoefficient,
|
||||||
0.95, -- Force coeff
|
0.95,
|
||||||
0.9 -- Slip coeff
|
0.9
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -290,15 +262,10 @@ function Wheel:update()
|
|||||||
Sy,
|
Sy,
|
||||||
Fx,
|
Fx,
|
||||||
Fy,
|
Fy,
|
||||||
1.05 -- Shape of the slip circle / ellipse.
|
1.05
|
||||||
)
|
)
|
||||||
|
|
||||||
--local Mx = Fy * (math.cos(Sx) - 1) + Fx * math.sin(Sx)
|
self.mz = self:selfAligningTorque(Sy, self.load)
|
||||||
--local My = Fx * (math.cos(Sy) - 1) + Fy * math.sin(Sy)
|
|
||||||
--local Mz = self:selfAligningTorque3(Mx, My, Sx, Sy)
|
|
||||||
local Mz = self:selfAligningTorque2(forwardSpeed, sideSpeed, self.load)
|
|
||||||
|
|
||||||
self.mz = Mz
|
|
||||||
|
|
||||||
self.angularVelocity = W
|
self.angularVelocity = W
|
||||||
self.counterTorque = CounterTq
|
self.counterTorque = CounterTq
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
-- @name koptilnya/mesh_loader/builder
|
--@name koptilnya/mesh_loader/builder
|
||||||
-- @include sv_builder.txt
|
--@include sv_builder.txt
|
||||||
-- @include cl_builder.txt
|
--@include cl_builder.txt
|
||||||
-- @include /koptilnya/libs/perma.txt
|
--@include /koptilnya/libs/perma.txt
|
||||||
|
--@shared
|
||||||
|
|
||||||
require("/koptilnya/libs/perma.txt")
|
require("/koptilnya/libs/perma.txt")
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
-- @name koptilnya/mesh_loader/cl_builder
|
--@name koptilnya/mesh_loader/cl_builder
|
||||||
-- @client
|
--@client
|
||||||
-- @include /koptilnya/libs/table.txt
|
--@include /koptilnya/libs/table.txt
|
||||||
-- @include obj_parser.txt
|
--@include obj_parser.txt
|
||||||
-- @include /koptilnya/libs/utils.txt
|
--@include /koptilnya/libs/utils.txt
|
||||||
-- @include /koptilnya/libs/constants.txt
|
--@include /koptilnya/libs/constants.txt
|
||||||
require("/koptilnya/libs/table.txt")
|
require("/koptilnya/libs/table.txt")
|
||||||
require("obj_parser.txt")
|
require("obj_parser.txt")
|
||||||
require("/koptilnya/libs/utils.txt")
|
require("/koptilnya/libs/utils.txt")
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- @name koptilnya/mesh_loader/obj_parser
|
--@name koptilnya/mesh_loader/obj_parser
|
||||||
-- @client
|
--@client
|
||||||
-- @include /koptilnya/libs/workers.txt
|
--@include /koptilnya/libs/workers.txt
|
||||||
require("/koptilnya/libs/workers.txt")
|
require("/koptilnya/libs/workers.txt")
|
||||||
|
|
||||||
ObjParser = class("ObjParser")
|
ObjParser = class("ObjParser")
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- @name koptilnya/mesh_loader/sv_builder
|
--@name koptilnya/mesh_loader/sv_builder
|
||||||
-- @server
|
--@server
|
||||||
-- @include /koptilnya/libs/workers.txt
|
--@include /koptilnya/libs/workers.txt
|
||||||
require("/koptilnya/libs/workers.txt")
|
require("/koptilnya/libs/workers.txt")
|
||||||
|
|
||||||
local TIMEOUT = 4
|
local TIMEOUT = 4
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
-- @name Torque editor
|
--@name Torque editor
|
||||||
-- @author Opti1337
|
--@author Opti1337
|
||||||
-- @shared
|
--@shared
|
||||||
-- @include /koptilnya/libs/render.txt
|
--@include /koptilnya/libs/render.txt
|
||||||
-- @include /koptilnya/gui/render_devices/hud.txt
|
--@include /koptilnya/gui/render_devices/hud.txt
|
||||||
-- @include /koptilnya/gui/gui.txt
|
--@include /koptilnya/gui/gui.txt
|
||||||
-- @include /koptilnya/gui/elements/panel.txt
|
--@include /koptilnya/gui/elements/panel.txt
|
||||||
-- @include /koptilnya/gui/elements/label.txt
|
--@include /koptilnya/gui/elements/label.txt
|
||||||
-- @include /koptilnya/gui/elements/shape.txt
|
--@include /koptilnya/gui/elements/shape.txt
|
||||||
-- @include /koptilnya/gui/elements/button.txt
|
--@include /koptilnya/gui/elements/button.txt
|
||||||
-- @include /koptilnya/gui/segoe_mdl2_assets_icons.txt
|
--@include /koptilnya/gui/segoe_mdl2_assets_icons.txt
|
||||||
local points = {
|
local points = {
|
||||||
Vector(0, 0),
|
Vector(0, 0),
|
||||||
Vector(100, 0)
|
Vector(100, 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user