Developer’s Comprehensive guide on Area Effector in Unity3D

The Area Effector 2D applies powers inside a region characterized by the joined Collider 2Ds when another (objective) Collider 2D comes into contact with the Effector 2D. You can arrange the power at any point with a particular size and arbitrary minor departure from that size. You can likewise apply both direct and precise drag strengths to layback Rigidbody 2Ds.

Collider that you use with the Area Effector would ordinarily be set as triggers, so that other Collider 2Ds can cover with it to have strengths connected. Non-triggers will in any case work, however strengths may be connected when Collider 2Ds come into contact with them.

Creating Area Effector 2D:

Now we explore the Area Effector 2D component which allows you to add 2D physical forces to objects which enter a trigger volume.

1

We have got 3 images, ‘Car’, ‘Arrow’, and  ‘Path’ in my scene. In this example, first of all set the path image as a background and then create sprites of Car and Arrows, Drag Car and Arrows on Path.Finally Add AreaEffector2D and BoxCollider2D component in inspector of all Arrows sprites.

Properties of AreaEffector2D:

Collider Mask figures out what layers will be influenced when articles enter the zone. For the time being, continue Everything chose.

Force Direction decides the degree heading of the power. The quality extents from – 359.99 to 359.99, which truly just characterizes a circle moving in either a clockwise or counter-clockwise course. As the picture beneath appears, zero focuses to one side and positive qualities move counter-clockwise along the circle; negative qualities move clockwise.

2

Force Magnitude permits you to set the quality of this current territory’s power, while Force Variation gives you a chance to characterize a reach to give some randomization to the power for every crash.

The Drag and Angular Drag alternatives permit you to encourage tweak the range’s belongings. Truth be told, you could utilize just drag values and no power qualities to make a territory that moderates any articles that enter.

Force Target decides when on the article the power gets connected. At the point when set to RigidBody, powers apply to the item’s focal point of mass, while setting it to Collider applies powers at the purpose of impact.

2

Set properties of AreaEffector2D and BoxCollider2D component same as mentioned above , In BoxCollider2D properties field ‘IsTrigger’ and ‘Used By Effecter’ must be checked, because after checking “Used By Effecter” field,we will see the effect of AreaEffector2D component,also add BoxCollider2D in Car inspector but no need to check property fields of ‘IsTrigger’ and ‘Used By Effecter’.

In this Example Car runs through the AreaEffector2D and BoxCollider2D component, So surely add in all arrows above two component, The Car BoxCollider2D trigger with the arrows BoxCollider2D and then get effect of AreaEffector2D and get force through the AreaEffector2D field that is “Force Magnitude” and change angle through the use of field Drag and Angular Drag. Here, we do not need to write any types of scripts.

Here’s a .gif.

4

Hiten Dodiya

Hiten Dodiya | Unity3D Game Developer

Being Professional Unity3D Game Developer at Yudiz Solutions Pvt. Ltd., I aim of developing mobile games in all deployment platforms. I am a self-motivated individual, always strives to improve my work, readily learn more and never afraid to try new approaches.
mm

Hiten Dodiya Unity3D Game Developer

Being Professional Unity3D Game Developer at Yudiz Solutions Pvt. Ltd., I aim of developing mobile games in all deployment platforms. I am a self-motivated individual, always strives to improve my work, readily learn more and never afraid to try new approaches.

Comments are closed.

Top