Ant Simulator 3D (Unity Asset) — simulator of termite (insect), bug or ant movement with C# code.
Features of Ant Simulator 3D
- Movement, rotation, jump;
- Fully customizable: 3 Parts of Legs, 3 Speeds, Jump Force and more;
- Easy to set up your own ant;
- No Mecanim and legacy animation — only C# code;
- Fast and stable physics simulation;
- Support experimental inverse kinematics, IK;
- Support Unity Free and Unity Pro;
- Full source code included.
- W, A, S, D — move;
- Q, E — rotate;
- Space — jump.
How to set up your own ant & Prefab
If you use Unity 2018.3 and higher, then just change predefined prefab and save it as new prefab.
Because Unit 2018.2 and older does not support nested prefabs, this asset doesn’t have a prefab of ant. But you can do it yourself after customizing of ant.
Instead of this, Ant Simulator 3D contains a prefab of a leg. You just need edit prefab and apply changes in the inspector at the end of work. So, you can set up all legs, editing only one leg.
It’s also possible to make each leg unique.
Hierarchy of Unity Prefab
It contains a script that controls the movement of an ant (LegsControl.cs) and the only RigidBody component of Ant.
The basis for all other parts. It contains pivot points for legs.
Leg Pivot contains all parts of a leg. The legs are rotating around Leg Pivots.
By default, the legs are the same. However, you can customize each leg individually. Inspector of the control script has separate fields for each part of each leg.
It is necessary to specify the number of legs for an ant. The default value is 6. But you can experiment with other values. We have not tested other cases.
Leg Part: Base, Middle, Final
It is necessary to clearly specify and configure every part of the leg. Specify each Transform for the corresponding field in inspector of the control script.
Start Rotational Angle & Delta Rotational Angle
From what angle leg part starts moving and how many degrees the movement continues.
- Start Rotational Angle = 15;
- Delta Rotational Angle = 15.
- Final Rotational Angle = 15 + 15 = 30.
Sphere for IK
At the end of the hierarchy of prefab, you need to place simple sphere Game Object.
So, the control script understands where each leg is located at any time.
Is it right leg?
Right leg = 1;
Left leg = 0.
Phase Shift & Phase Shift Delta
To simulate the movement of an ant, it is necessary that the opposing legs (relative to the body) were in the same phase of the movement.
The speed of ant movement in the XOZ plane.
The speed of ant rotation around its local Y axis.
Unified the speed of legs movement in any form of movement.
It determines how high the ant will jump up.
Seconds Between Jumping
After how many seconds the next jump is possible?
Inverse Kinematics (IK) — Experimental Mode
Is IK Enabled
If it is false, the ant is suitable for walking on a flat surface.
If it is true, the ant is suitable for walking on a surface with obstacles.
It determines how strongly ant reacts to obstacles, moving other related parts.
Check the current version of Unity Ant Simulator 3D on Asset Store.
The latest versions will be added as soon as possible.
- Unity 2018.3 version.
- Unity 2017.3.1 version.