Skip to content

Commit

Permalink
Add collision generator (gencol)
Browse files Browse the repository at this point in the history
  • Loading branch information
indilo53 committed May 14, 2019
1 parent caea2a1 commit 5eeb77d
Show file tree
Hide file tree
Showing 10 changed files with 2,032 additions and 5 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,36 @@ gtautil createarchive --input build --output . --name dlc

if will generate a dlc named **gtauclothes** (hardcoded for now) so you put the dlc.rpf in **dlcpacks/gtauclothes**

### Generate collision from drawable

1) Generate static collision

```
gtautil gencol --input mfile.ydr --output mfile.ybn
```

2) Generate embedded collision

```
gtautil gencol --input mfile.ydr --output file2.ydr
```

3) Generate static collision using hull algorithm

```
gtautil gencol --input file.ydr --output file.ybn --mode hull
```

4) Various options

```
gtautil gencol --input file.ydr --output file.ybn --mode hull --smooth 10 --triangles 200
```

smooth : Number of passes to smooth out mesh

triangles: Max mesh triangles count



**Import xml meta**
Expand Down
23 changes: 23 additions & 0 deletions gtautil/Commandline/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,29 @@ public class MoveYmapOptions
public List<float> Rotation { get; set; }
}

[Verb("gencol")]
public class GenColOptions
{
[Option('i', "input", HelpText = "Input file")]
public string InputFile { get; set; }

[Option('o', "output", HelpText = "Output file")]
public string OutputFile { get; set; }

[Option('s', "smooth", Default = 0, HelpText = "Number of passes to smooth the mesh")]
public int Smooth { get; set; }

[Option('t', "triangles", Default = -1, HelpText = "Max triangle count in generated collision")]
public int TriangleCount { get; set; }

[Option('q', "quantum", Default = 512, HelpText = "Quantum multiplier => (bbMax - bbMin) / (2 ^ multiplier)")]
public int Qantum { get; set; }

[Option('m', "mode", Default = "copy")]
public string Mode { get; set; }

}

[Verb("test")]
public class TestOptions
{
Expand Down
23 changes: 23 additions & 0 deletions gtautil/GTAUtil.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Compile Include="Commandline\Arguments.cs" />
<Compile Include="Commandline\Commandline.cs" />
<Compile Include="Commandline\Options.cs" />
<Compile Include="Program\GenCol.cs" />
<Compile Include="Program\ExtractArchive.cs" />
<Compile Include="Program\CreateArchive.cs" />
<Compile Include="Program\FixArchive.cs" />
Expand Down Expand Up @@ -109,9 +110,18 @@
<Reference Include="Costura, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.4.0.0\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="geometry3Sharp, Version=1.0.324.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\geometry3Sharp.1.0.324\lib\net45\geometry3Sharp.dll</HintPath>
</Reference>
<Reference Include="Glob, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2561fd83231d3038, processorArchitecture=MSIL">
<HintPath>..\packages\Glob.cs.3.0.27\lib\net40\Glob.dll</HintPath>
</Reference>
<Reference Include="KellermanSoftware.Compare-NET-Objects, Version=4.58.0.0, Culture=neutral, PublicKeyToken=d970ace04cc85217, processorArchitecture=MSIL">
<HintPath>..\packages\CompareNETObjects.4.58.0\lib\net46\KellermanSoftware.Compare-NET-Objects.dll</HintPath>
</Reference>
<Reference Include="MIConvexHull, Version=1.1.19.504, Culture=neutral, PublicKeyToken=2644b6f8be52c998, processorArchitecture=MSIL">
<HintPath>..\packages\MIConvexHull.1.1.19.504\lib\netstandard1.0\MIConvexHull.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand All @@ -132,6 +142,16 @@
<Reference Include="System.IO.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=96bf224d23c43e59, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Abstractions.3.0.10\lib\net40\System.IO.Abstractions.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand All @@ -153,6 +173,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="MIConvexHull.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down
Loading

0 comments on commit 5eeb77d

Please sign in to comment.