Trailer Issues

Recently, i've modeled a log trailer and wanted to get it in game. Ive got it in game and you can spawn it, but I have no idea how to make it an addon in the code.

Thanks,
Risky

this will work the best, a trailer its actually another truck xml and since you said its a log trailer the new tags in the game data section will make it be able to carry loads
check the trailer Cart xml in the media/classes/trucks and trailer_short_cart too for more reference also check the load_medium and other classes for references in the loads

remove some of the <Body/> tags to match yours if its a single _cdt

<_templates Include="trucks">
<Wheel>
<Wheel
HardpointOffsetY="-0.15"
SuspensionMin="-0.6"
SuspensionStrength="0.025"
Torque="default"
Type="ural_cart"
/>
</Wheel>
</_templates>
<Truck>
<Wheels
HardpointDefaultY="0.519"
HardpointDefaultZ="1.02"
>
<Wheel _template="Wheel" HardpointX="-5.735" />
<Wheel _template="Wheel" HardpointX="-5.735" RightSide="true" />
<Wheel _template="Wheel" HardpointX="-4.556" />
<Wheel _template="Wheel" HardpointX="-4.556" RightSide="true" />
</Wheels>
<TruckData>
<OcclusionMap
HalfSizeZ="2.00"
MinX="-6.28"
MaxX="-3.68"
Texture="trucks/occlusion/chassis_trailer__s_d_a.tga"
/>
<Constraint _template="TrailerRagdoll">
<PlaneConeMotor Damping="6000" Spring="20000" Type="Spring" />
</Constraint>
<Camera Center="(-5.0; 0; 0)" />
<Axles>
<Axle Frame="BoneAxle1" />
<Axle Frame="BoneAxle2" />
</Axles>
</TruckData>
<PhysicsModel Mesh="trucks/trailer_cart">
<Body ImpactType="Truck" Mass="1000">
<Body _template="CartForkBase" ModelFrame="BoneFork_cdt">
<Body _template="ForkTopChain" ModelFrame="BoneTopChain_cdt">
<Constraint MinLimit="-2">
<Motor Damping="30" Spring="70" />
</Constraint>
</Body>
<Body _template="CartFork" ModelFrame="BoneForkLeft_cdt">
<Constraint AxisLocal="(-1;0;0)" />
</Body>
<Body _template="CartFork" ModelFrame="BoneForkRight_cdt" />
</Body>
</Body>
</PhysicsModel>
<ModelAttachments>
<StopSignals>
<Light _template="StopSignal" Pos="(-5.337; 1.305; 0)" />
<Flare _template="StopSignal" Pos="(-5.537; 1.305; 0.5)" />
<Flare _template="StopSignal" Pos="(-5.537; 1.305; -0.5)" />
</StopSignals>
<Ignition>
<Light _template="IgnitionSignalRed" Pos="(-5.337; 1.305; 0)" />
<Flare _template="IgnitionSignalRed" Pos="(-5.537; 1.305; 0.5)" />
<Flare _template="IgnitionSignalRed" Pos="(-5.537; 1.305; -0.5)" />
</Ignition>
</ModelAttachments>
<GameData>
<WinchSocket Pos="(-5.545; 1.0; 0)" />
<WinchSocket Pos="(-2.76; 0.944; 0)" />
<RequiredAddon Types="ural_cart,kraz_cart" />
<LoadArea Min="(-6.359; 1.364; -1.12)" Max="(-4.064; 2.75; 1.12)" Type="MediumLogs" />
<InstallSocket Offset="(-2.761; 0.942; 0.0)" Type="UralCartTrailer" />
</GameData>
</Truck>

last edited by Forces

Ok, ive got the trailer in the game (dont mind the wheels ill change em later) but im really not sure how you would add the logs in?
0_1539468719130_20181013170956_1.jpg

@Forces i've used your code, and in the load logs (in-game) it wont let me add on the logs.

good, here is a tip just like a truck use the CenterOffMassOffset to make the weight of the trailer rest near its wheels that way you take some of the weight of the trailer from the truck

now for logs, you need to model them like youll do with a addon but instead of making it in the truck you have to build it in the trailer and use this code

(taken from my s10 Teaser car load for its trailer)

<_parent File="load_logs_short_trailer" />
<TruckAddon _noinherit="true">
<PhysicsModel Mesh="trucks/1998_Chevy_S10_TrailerLoad">
<Body
CenterOfMassOffset="(-0.231; -0.4; 0)"
ImpactType="Truck"
Mass="1000"
>
<Constraint Type="Fixed" />
<Body ImpactType="Truck" Mass="460" ModelFrame="Car_cdt">
<Constraint
AxisLocal="(0;1;0)"
MinLimit="-0.07"
MaxLimit="0.05"
Type="Prismatic"
>
<Motor Damping="1500" Spring="75000" Type="Spring" />
</Constraint>
</Body>
</Body>
</PhysicsModel>
<GameData LoadPoints="3" ManualLoads="3">
<SpawnLoadOrigin Position="(-6; 3.209; -0)" />
<RequiredAddon Types="1998_Trailer_Car" />
<InstallSocket Type="CarTrailerLoad" />
</GameData>
</TruckAddon>

youll need to remove some extra <Body/> to match yours but thats how you make a load addon for a trailer,

and here is another trailer example xml
this is the trailer for that load

<Truck>
<Wheels
HardpointDefaultY="0.72731"
HardpointDefaultZ="1.05"
>
<Wheel _template="TrailerWheel" HardpointX="-6.10033" />
<Wheel _template="TrailerWheel" HardpointX="-6.10033" RightSide="true" />
<Wheel _template="TrailerWheel" HardpointX="-6.95033" />
<Wheel _template="TrailerWheel" HardpointX="-6.95033" RightSide="true" />
</Wheels>
<TruckData>
<OcclusionMap HalfSizeZ="1.75" MinX="-8.389" MaxX="-3.161" />
<Constraint _template="TrailerRagdoll" />
<Camera Center="(-9.094; 1.941; 0)" />
<Axles>
<Axle Frame="TR" />
<Axle Frame="TF" />
</Axles>
</TruckData>
<PoweredConstraints>
<Group Id="foot_push">
<Constraint Name="Foot" Position="-0.9" TerminalFix="true" />
</Group>
</PoweredConstraints>
<PhysicsModel Mesh="trucks/1998_Chevy_S10_Car_Trailer">
<Body
CenterOfMassOffset="(-0.231; -0.4; 0)"
Friction="2"
ImpactType="Truck"
Mass="200"
ModelFrame="Trailer_cdt"
>
<Body
Friction="1"
Mass="50"
ModelFrame="Ramp_cdt"
NoFoliageCollisions="true"
>
<Constraint
AxisLocal="(0;0;1)"
MinLimit="-0"
MaxLimit="130"
Name="Ramps"
Type="Hinge"
>
<Motor Force="40000" Tau="0.15" Type="Position" />
</Constraint>
</Body>
</Body>
</PhysicsModel>
<ModelAttachments>
<StopSignals>
<Light _template="StopSignal" Pos="(-8.334; 1.221; -0.933)" ParentFrame="Trailer_cdt" />
<Light _template="StopSignal" Pos="(-8.334; 1.221; 0.933)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.334; 1.221; -1.093)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.334; 1.221; 1.093)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.33439;1.22134;-0.93325)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.33439;1.22134;0.93325)" ParentFrame="Trailer_cdt" />
</StopSignals>
<ReverseSignals>
<Light _template="ReverseSignal" Pos="(-8.334; 1.221; -1.011)" ParentFrame="Trailer_cdt" />
<Light _template="ReverseSignal" Pos="(-8.334; 1.221; 1.011)" ParentFrame="Trailer_cdt" />
<Flare _template="ReverseSignal" Pos="(-8.334; 1.221; -1.011)" ParentFrame="Trailer_cdt" />
<Flare _template="ReverseSignal" Pos="(-8.334; 1.221; 1.011)" ParentFrame="Trailer_cdt" />
</ReverseSignals>
<Ignition>
<Flare
_template="RedLight"
Pos="(-8.16819;1.22135;-1.13912)"
Size="0.05"
SizeMultAtDay="0.02"
ParentFrame="Trailer_cdt"
/>
<Flare
_template="RedLight"
Pos="(-8.16819;1.22135;-1.13912)"
Size="0.05"
SizeMultAtDay="0.02"
ParentFrame="Trailer_cdt"
/>
</Ignition>
</ModelAttachments>
<GameData>
<WinchSocket Pos="(-2.516; 1.117; -0.0)" ParentFrame="Trailer_cdt" />
<WinchSocket Pos="(-8.33; 1.159; -0.868)" ParentFrame="Trailer_cdt" />
<WinchSocket Pos="(-8.33; 1.159; 0.868)" ParentFrame="Trailer_cdt" />
<LoadArea
Min="(-8.265; 1.245; 1.1)"
Max="(-3.2; 2.9; - 1.1)"
TrailerLoad="true"
Type="shortLogs"
ParentFrame="Trailer_cdt"
/>
<InstallSocket Offset="(-2.516; 1.117; -0.0)" Type="1998_S10_Trailer" />
<AddonSockets>
<Socket Names="CarTrailerLoad" ParentFrame="Trailer_cdt" />
</AddonSockets>
</GameData>
<ControlledConstraints>
<Constraint Id="Ramps" Name="Ramps" />
</ControlledConstraints>
</Truck>

@forces said in Trailer Issues:

good, here is a tip just like a truck use the CenterOffMassOffset to make the weight of the trailer rest near its wheels that way you take some of the weight of the trailer from the truck

now for logs, you need to model them like youll do with a addon but instead of making it in the truck you have to build it in the trailer and use this code

(taken from my s10 Teaser car load for its trailer)

<_parent File="load_logs_short_trailer" />
<TruckAddon _noinherit="true">
<PhysicsModel Mesh="trucks/1998_Chevy_S10_TrailerLoad">
<Body
CenterOfMassOffset="(-0.231; -0.4; 0)"
ImpactType="Truck"
Mass="1000"
>
<Constraint Type="Fixed" />
<Body ImpactType="Truck" Mass="460" ModelFrame="Car_cdt">
<Constraint
AxisLocal="(0;1;0)"
MinLimit="-0.07"
MaxLimit="0.05"
Type="Prismatic"
>
<Motor Damping="1500" Spring="75000" Type="Spring" />
</Constraint>
</Body>
</Body>
</PhysicsModel>
<GameData LoadPoints="3" ManualLoads="3">
<SpawnLoadOrigin Position="(-6; 3.209; -0)" />
<RequiredAddon Types="1998_Trailer_Car" />
<InstallSocket Type="CarTrailerLoad" />
</GameData>
</TruckAddon>

youll need to remove some extra <Body/> to match yours but thats how you make a load addon for a trailer,

and here is another trailer example xml
this is the trailer for that load

<Truck>
<Wheels
HardpointDefaultY="0.72731"
HardpointDefaultZ="1.05"

	<Wheel _template="TrailerWheel" HardpointX="-6.10033" />
	<Wheel _template="TrailerWheel" HardpointX="-6.10033" RightSide="true" />
	<Wheel _template="TrailerWheel" HardpointX="-6.95033" />
	<Wheel _template="TrailerWheel" HardpointX="-6.95033" RightSide="true" />

</Wheels>
<TruckData>
<OcclusionMap HalfSizeZ="1.75" MinX="-8.389" MaxX="-3.161" />
<Constraint _template="TrailerRagdoll" />
<Camera Center="(-9.094; 1.941; 0)" />
<Axles>
<Axle Frame="TR" />
<Axle Frame="TF" />
</Axles>
</TruckData>
<PoweredConstraints>
<Group Id="foot_push">
<Constraint Name="Foot" Position="-0.9" TerminalFix="true" />
</Group>
</PoweredConstraints>
<PhysicsModel Mesh="trucks/1998_Chevy_S10_Car_Trailer">
<Body
CenterOfMassOffset="(-0.231; -0.4; 0)"
Friction="2"
ImpactType="Truck"
Mass="200"
ModelFrame="Trailer_cdt"
>
<Body
Friction="1"
Mass="50"
ModelFrame="Ramp_cdt"
NoFoliageCollisions="true"
>
<Constraint
AxisLocal="(0;0;1)"
MinLimit="-0"
MaxLimit="130"
Name="Ramps"
Type="Hinge"
>
<Motor Force="40000" Tau="0.15" Type="Position" />
</Constraint>
</Body>
</Body>
</PhysicsModel>
<ModelAttachments>
<StopSignals>
<Light _template="StopSignal" Pos="(-8.334; 1.221; -0.933)" ParentFrame="Trailer_cdt" />
<Light _template="StopSignal" Pos="(-8.334; 1.221; 0.933)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.334; 1.221; -1.093)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.334; 1.221; 1.093)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.33439;1.22134;-0.93325)" ParentFrame="Trailer_cdt" />
<Flare _template="RedLightSpun" Pos="(-8.33439;1.22134;0.93325)" ParentFrame="Trailer_cdt" />
</StopSignals>
<ReverseSignals>
<Light _template="ReverseSignal" Pos="(-8.334; 1.221; -1.011)" ParentFrame="Trailer_cdt" />
<Light _template="ReverseSignal" Pos="(-8.334; 1.221; 1.011)" ParentFrame="Trailer_cdt" />
<Flare _template="ReverseSignal" Pos="(-8.334; 1.221; -1.011)" ParentFrame="Trailer_cdt" />
<Flare _template="ReverseSignal" Pos="(-8.334; 1.221; 1.011)" ParentFrame="Trailer_cdt" />
</ReverseSignals>
<Ignition>
<Flare
_template="RedLight"
Pos="(-8.16819;1.22135;-1.13912)"
Size="0.05"
SizeMultAtDay="0.02"
ParentFrame="Trailer_cdt"
/>
<Flare
_template="RedLight"
Pos="(-8.16819;1.22135;-1.13912)"
Size="0.05"
SizeMultAtDay="0.02"
ParentFrame="Trailer_cdt"
/>
</Ignition>
</ModelAttachments>
<GameData>
<WinchSocket Pos="(-2.516; 1.117; -0.0)" ParentFrame="Trailer_cdt" />
<WinchSocket Pos="(-8.33; 1.159; -0.868)" ParentFrame="Trailer_cdt" />
<WinchSocket Pos="(-8.33; 1.159; 0.868)" ParentFrame="Trailer_cdt" />
<LoadArea
Min="(-8.265; 1.245; 1.1)"
Max="(-3.2; 2.9; - 1.1)"
TrailerLoad="true"
Type="shortLogs"
ParentFrame="Trailer_cdt"
/>
<InstallSocket Offset="(-2.516; 1.117; -0.0)" Type="1998_S10_Trailer" />
<AddonSockets>
<Socket Names="CarTrailerLoad" ParentFrame="Trailer_cdt" />
</AddonSockets>
</GameData>
<ControlledConstraints>
<Constraint Id="Ramps" Name="Ramps" />
</ControlledConstraints>
</Truck>

Sooo your sayin i outta model them myself? Also i aint got an issue with modelin em, just wonderin

@riskywisky thats because the trailer _Cdt and logs _cdt hit each other , making stock game loads spawn in mods trailer or trucks its a pain so its better making your own and trouble shot codes and _cdt sizes from there

@Forces Ok, thanks! I'll model my own... but do you put it on the trailer model or make it as a seperate mesh? Sorry im real new to this whole trailer thing 😕

@riskywisky model it like if it was in game, (separate meshes and _cdts) but in the place you need it, like a addon because a load it that a addon but it goes attached to the trailer via xml

Ok, i see. Ive got it modeled below too.
0_1539475165832_LogsCapture.PNG

@Forces ive gotten everything working in the editor, and everything coded, but in game it still does not let me select the mods.

Trailer Code:

<Truck>
<Wheels
HardpointDefaultY="0.5"
HardpointDefaultZ="0.7"
>
<Wheel
HardpointX="-0.186"
Type="zil_front"
SteeringAngle="0"
SuspensionMin="-0.3"
SuspensionStrength="0.05"
/>
<Wheel
HardpointX="-0.186"
RightSide="true"
Type="zil_front"
SteeringAngle="0"
SuspensionMin="-0.3"
SuspensionStrength="0.05"
/>
<Wheel
HardpointX="-1.3"
Type="zil_front"
SteeringAngle="0"
SuspensionMin="-0.3"
SuspensionStrength="0.05"
/>
<Wheel
HardpointX="-1.3"
RightSide="true"
Type="zil_front"
SteeringAngle="0"
SuspensionMin="-0.3"
SuspensionStrength="0.05"
/>
</Wheels>
<TruckData FuelCapacity="300" RepairsCapacity="300">
<LimitedFluid
Center="(-4.400; 0.840; -0.999)"
SizeX="1.200"
SizeY="0.350"
SizeZ="0.310"
Type="Box"
/>
<Camera Center="(-6.0; 0; 0)" />
<Constraint
PlaneAxisLocal="(0; 0; 1.0)"
PlaneMin="-90"
PlaneMax="90"
TwistAxisLocal="(1.0; 0; 0)"
TwistMin="-30"
TwistMax="30"
Type="Ragdoll"
>
<TwistMotor Damping="60000" Spring="320000" Type="Spring" />
</Constraint>
<Axles>
<Axle Frame="B1" LeftWheel="0" RightWheel="1" />
<Axle Frame="B2" LeftWheel="2" RightWheel="3" />
</Axles>
</TruckData>
<PhysicsModel Mesh="trucks/trailer">
<Body
Mass="3000"
ImpactType="Truck"
CenterOfMassOffset="(0.014; -1; 0)"
>
<Body ModelFrame="bort1" Mass="200" Collisions="Internal">
<Constraint
Name="bort1"
Type1="Fixed"
Type="Hinge"
AxisLocal="(-1;0;0)"
MinLimit="0"
MaxLimit="180"
PivotOffset1="(-1.0; -0.3; 0.0)"
>
<Motor Type="Position" Force="9000" />
</Constraint>
</Body>
<Body ModelFrame="bort2" Mass="200" Collisions="Internal">
<Constraint
Name="bort2"
Type1="Fixed"
Type="Hinge"
AxisLocal="(-1;0;0)"
MinLimit="0"
MaxLimit="180"
PivotOffset1="(-1.0; -0.3; 0.0)"
>
<Motor Type="Position" Force="9000" />
</Constraint>
</Body>
<Body ModelFrame="bort3" Mass="200" Collisions="Internal">
<Constraint
Name="bort3"
Type1="Fixed"
Type="Hinge"
AxisLocal="(-1;0;0)"
MinLimit="-180"
MaxLimit="0"
PivotOffset1="(-1.0; -0.3; 0.0)"
>
<Motor Type="Position" Force="9000" />
</Constraint>
</Body>
<Body ModelFrame="bort4" Mass="200" Collisions="Internal">
<Constraint
Name="bort4"
Type1="Fixed"
Type="Hinge"
AxisLocal="(-1;0;0)"
MinLimit="-180"
MaxLimit="0"
PivotOffset1="(-1.0; -0.3; 0.0)"
>
<Motor Type="Position" Force="9000" />
</Constraint>
</Body>
<Body
ModelFrame="Foot"
Mass="100"
NoFoliageCollisions="true"
>
<Constraint
Name="Foot"
Type="Prismatic"
AxisLocal="(0;0;1)"
MinLimit="-0.6634"
MaxLimit="0"
>
<Motor Type="Position" Force="16000" />
</Constraint>
</Body>
</Body>
</PhysicsModel>
<ModelAttachments>
<StopSignals>
<Flare
Pos="(-10.038; 1.233; -0.971)"
AspectRatio="1.4"
Color="g(255; 0; 0) x 0.4"
ColorMultAtDay="0.6"
Dir="(-1.0; 0; 0)"
DirAngle="90"
Reflections="true"
Size="1.8"
/>
<Flare
Pos="(-10.038; 1.237; 0.952)"
AspectRatio="1.4"
Color="g(255; 0; 0) x 0.4"
ColorMultAtDay="0.6"
Dir="(-1.0; 0; 0)"
DirAngle="90"
Reflections="true"
Size="1.8"
/>
</StopSignals>
</ModelAttachments>
<GameData GaragePoints="4">
<LoadArea
Min="(-8.487; 1.4; -1.2)"
Max="(-6.677; 2.7; 1.2)"
TrailerLoad="true"
Type="logs"
ParentFrame="BoneRear_cdt"
/>
<WinchSocket Pos="(-7.64; 1.353; 0.723)" />
<WinchSocket Pos="(-7.64; 1.353; -0.723)" />
<WinchSocket Pos="(-9.94; 1.353; 0)" />
<InstallSocket Offset="(3.813; 1.071; 0.012)" Type="trailer" />
<AddonSockets>
<Socket Names="trailer" Offset="(0.0; -0.0; -0.0)" />
</AddonSockets>
</GameData>
</Truck>

Log Code:

<TruckAddon>
<PhysicsModel Mesh="trucks/logs">
<Body
Collisions="All"
Friction="0.1"
ImpactType="Foliage"
Mass="5000"
>
<Body
Collisions="All"
Friction="0.1"
ImpactType="Foliage"
Mass="3000"
>
<Body
Collisions="All"
Friction="0.1"
ImpactType="Foliage"
Mass="4000"
>
</Body>
</Body>
</PhysicsModel>
<LoadCheckPoint Pos="(-3.458; 2.151; 0)" ParentFrame="BoneBottom_cdt" />
<GameData LoadPoints="6" ManualLoads="2">
<SpawnLoadOrigin Position="(2.238; 2.48; 0)" />
<InstallSocket Type="logs" />
</GameData>
</TruckAddon>

I really dont know what is wrong with any of it, and if you could help that would be amazing 😉

last edited by RiskyWisky

@Forces Still, i cannot get logs to load the trailer (not even the custom ones ive made)
0_1539484477929_20181013213419_1.jpg

So, does anyone know how to get this working?? All i am trying to do is get logs on my custom trailer...

weird.. did you added this too?

	<LoadArea
		Min="(-8.265; 1.245; 1.1)"
		Max="(-3.2; 2.9; - 1.1)"
		TrailerLoad="true"
		Type="shortLogs"
		ParentFrame="Trailer_cdt"
	/>

dont add offsets to you load xml or the install socket, the load just like addons has to be spawned where it modeled

@Forces yea the logs work now but when i add a 2nd trailer to the list on addons no addons appear. I cannot even spawn addons in.

@Forces on the addon list there is no selection for addons or trailers, even though this code is in the .xml for the truck:

	<AddonSockets>
		<Socket Names="trailer" Offset="(-2.531; 1.011; 0.044)" />
		<Socket Names="fueltrailer" Offset="(-2.531; 1.011; 0.044)" />		
	</AddonSockets>

you don't need 2 sockets if they're in the same position anyway, just use the same socket

They are 2 different trailers buddy.

@riskywisky i know buddy, but they can use the same addon socket

how would that work?

Looks like your connection to Focus Home Interactive - Official Forums was lost, please wait while we try to reconnect.