'How to attach "SwingBalls"' (Ver.3.0)

Please feel free to contact me if you have any questions.
shopmaster@chobi-glass.com
http://chobi-glass.com/Unity/index.html



*** Outline ***

This section shows how to attach "SwingBalls" to the tank made in the previous steps.

"SwingBalls" are invisible physics objects attached to the MainBody with Configurable Joints.
They are swaying according to the tank motion in the runtime.

"Static_Track" is able to get the swaying movements in combination with the "SwingBalls.
(Note.)
"Physics_Track" and "Scroll_Track" cannot work with "SwingBalls" to get the swaying movements.



*** How to attach "SwingBalls" ***

(1) Attach "Create_SwingBall" object to the MainBody.

You can find the prefab "Create_SwingBall" in the "Tank_Components" folder under the "Prefabs" folder.


Drag and drop it into the "MainBody" in the Hierarchy window, and make sure that the "Create_SwingBall" is placed under the "MainBody" as a child.



(2) Align the SwingBalls with the SupportWheels or RoadWheels.

Select the "Create_SwingBall", and press the "Align with SupportWheels" button or "Align with RoadWheels" button according to the tank.
When the tank has SupportWheels (return rollers) such as Firefly and Panzer-IV, use the "Align with SupportWheels" button.
When the tank does not have any Supportwheel such as Cromwell and Tiger-I, use the "Align with RoadWheels" button.

In this tutorial, press the "Align with SupportWheels" button, because our new tank has support wheels.


Make sure that new SwingBalls are created on each SupportWheel.



(3) Reset the types of the pieces in the "Static_Track".

Select the "Static_Track", and press the "Set Types with SwingBalls" button.


The track pieces on the SwingBalls are changed into "Anchor" type, and their reference values are set automatically.


The result is displayed in the Console window.
If you cannot get a satisfying result, adjust the "SwingBall Effective Range" value, and press the button again.



(4) Test the motion in the runtime.

Make sure that the track pieces are swaying between the SupportWheels and the upper covers, while driving the tank on the rugged road.



(5) Add new "SwingBalls" into the gaps of the SupportWheels.

Add new SwingBalls into the gaps of the SupportWheels so that our tracks are able to sway more realistically.
(You can skip this step when the tank does not have any SupportWheel.)

Duplicate the "Create_SwingBall", and move the new one to the gap between the front end wheel and the first SupporWheel.


Next, adjust the values so that the new SwingBalls are placed in each gap of the wheels.
In this tutorial, set as follows.



(6) Reset the types of the pieces again, and test the motion.

Select the "Static_Track", and press the "Set Types with SwingBalls" button.


The track pieces on the new SwingBalls are changed into "Anchor" type.


Test the tracks in the runtime, and make sure that the pieces are swaying according to the tank motion.


If you cannot get a satisfying result, adjust the "SwingBall Effective Range" value, and press the button again.
In this tutorial, increase the "SwingBall Effective Range" value to "0.3", and press the button.

(Note.)
You can reset all the upper pieces to "Static" type by pressing the "Make Upper Pieces 'Static'" button.



Progress to the next section.

Our "Static_Track" has got a swaying motion.


"Static_Track" can be made breakable by attaching some special colliders called "Track_Collider".
In the next section, we will attach the "Track_Collider" to our tracks, so that our new tank can be used in the battle scenens.

Please progress to the next section 'How to attach "Track_Colliders"'.