Algoryx / AGXUnity

AGX Dynamics Unity 3D plugin
Apache License 2.0
69 stars 19 forks source link

agx-dynamics-for-unity

AGX Dynamics for Unity - AGXUnity

Unity bindings for AGX Dynamics from Algoryx Simulation AB.

AGX Dynamics is a professional multi-purpose physics engine for simulators, Virtual Reality (VR), engineering, large scale granular simulations and more. AGX is being utilized in hundreds of training simulators and helps engineers design and evaluate new mechanical systems in Algoryx Momentum and Algoryx Momentum Granular.

Official package

Please check AGX Dynamics for Unity product page for more information.

Installation - with AGX Dynamics installed separately

If you don't want to use AGX Dynamics for Unity (with AGX Dynamics included), the AGXUnity plugin can be installed separately following these instructions and alternatives. Unity has to be started with AGX Dynamics environment variables - for example (command prompt):


C:\>"Program Files\Algoryx\agx-2.21.0.0\setup_env.bat"

Visual Studio version range:
    [15.0, 16.0)
Visual Studio installation path:
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional
vcvarsall.bat used:
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.5.1
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

Using Python interpreter C:\Program Files\Python35\python.exe

C:\>"Program Files\Unity\Editor\Unity.exe" -projectPath MyUnityProject

Note that -projectPath has to be given when you have Unity Hub installed, since Unity Hub doesn't forward the environment variables to the Unity process.

Without the AGX environment, Unity could crash or output error: DllNotFoundException: agxDotNetRuntime.dll

From package

You can find packages in Releases.

  1. Drag and drop AGXUnity-x.y.unitypackage into the Assets folder in Unity.
  2. Copy agxDotNet.dll (<agx_dynamics_install_dir>/bin/x64/agxDotNet.dll) into AGXUnity plugins folder (Assets/AGXUnity/Plugins/x86_64).
  3. Change Script Runtime Version to .NET 4.x: Edit -> Project Settings -> Player. Under Other Settings set Scripting Runtime Version to .NET 4.x Equivalent. More information.

From source

  1. git clone https://github.com/Algoryx/AGXUnity.git in the Assets folder of your Unity project.
  2. Copy agxDotNet.dll (<agx_dynamics_install_dir>/bin/x64/agxDotNet.dll) into AGXUnity plugins folder (Assets/AGXUnity/Plugins/x86_64).
  3. Change Script Runtime Version to .NET 4.x: Edit -> Project Settings -> Player. Under Other Settings set Scripting Runtime Version to .NET 4.x Equivalent. More information.

Requirements

Required versions:

AGXUnity Unity Editor AGX Dynamics
5.1 2021.2 2.37.4.0
5.0 2021.2 2.37.3.0
4.7 2021.2 2.37.1.0
4.6 2021.2 2.37.0.1
4.5 2020.3 LTS 2.36.1.0
4.4 2020.3 LTS 2.36.1.0
4.3 2020.3 LTS 2.36.0.0
4.2 2018.4 LTS 2.35.0.3
4.1 2018.4 LTS 2.35.0.2
4.0 2018.4 LTS 2.35.0.0

Additional Requirements:

Migrating from AGXUnity-deprecated to AGXUnity

See "Migration" in the AGXUnity-deprecated repository.

Developer

For more information about how to develop new functionality in AGXUnity - read the developer guide.

Tutorials

A modern tutorial series is currently being developed and videos are published in a youtube playlist.

Tutorial 1: Introduction

Tutorial 2: RigidBodies and Shapes

Tutorial 3: Physical Materials

Tutorial 4: Constraints

Tutorial 5: Modelling a car

Older tutorials

Modelling a crane :

Modelling with primitives:

Modelling with materials:

Modelling with constraints:

Modelling with triangle meshes:

Modelling with wires:

Modelling a terrain vehicle:

Binary distribution

To distribute an Unity3D application together with AGX Dynamics, you need to collect the required runtime files from your AGX installation. These files must match the version of AGX used when building the Unity3D application.

Below is a list of required files/directories which come from the /bin/x64/ directory. These files should be placed in the top directory together with your Unity exe-file. In version 2.22.1.0 and later, AGX Dynamics comes with a python script that will copy the required runtime files to a named (non-existing) directory: \data\python\utilities\copy_runtimes.py

agx.lic
agxCable.dll
agxCore.dll
agxDotNet.dll
agxDotNetRuntime.dll
agxHydraulics.dll
agxLua.dll
agxMex.dll
agxModel.dll
agxOSG.dll
agxPhysics.dll
agxPython.dll
agxSabre.dll
agxSensor.dll
agxVehicle.dll
colamd.dll
glew.dll
libpng.dll
lua.dll
mscorlib.dll
msvcp140.dll
ois.dll
osg141-osg.dll
osg141-osgDB.dll
osg141-osgGA.dll
osg141-osgShadow.dll
osg141-osgSim.dll
osg141-osgText.dll
osg141-osgUtil.dll
osg141-osgViewer.dll
ot20-OpenThreads.dll
python35.dll
vcruntime140.dll
websockets.dll
zlib.dll

And also, the directory: Components (from bin\x64\plugins)

Directory: plugins

Depending on Visual Studio version, the following files might differ:

mscorlib.dll
msvcp140.dll
vcruntime140.dll

Issues and contributions

Do not hesitate to send us a Pull Request.

If something is missing or not working as expected - fix it and send a pull request.

If you have no idea how to implement a feature or fix a bug - create an issue.

License

Apache License 2.0