CGF - Manual

1.0 Getting Started with CGF

When working with Circular Gravity Force, the main core component is called a CGF Object or CGF 2D when working with 2D objects.

 

Creating CGF - Toolbar

Under the toolbar click Tools->Resurgam Studios->CGF->Quick CGFor Quick CGF 2D

CGF_Manual 1.1 - Toolbar.png
 

Creating CGF - Hierarchy

In the Hierarchy right click and go to 3D Object->CGF or Object->CGF 2D

CGF_Manual 1.1 - Hierarchy.png
 

Creating CGF - Shortcut

Press Alt+Q to create a CFG object or Alt+Shift+Q for a CGF 2D

 

Creating CGF - Add Component

Create and select a new GameObject click Add Component and select Physics->Circular Gravity Force or Physics 2D->Circular Gravity Force 2D

CGF_Manual 1.1 - Add Componet.png
 

2.0 Main Properties

Enable

Enable/Disable the Circular Gravity Force by using this checkbox, very useful for turning on and off the CGF. You can access this ether animation or through a script.

 

Shape

The shape of the Circular Gravity Force, you can access this ether animation or through a script.

Sphere

Capsule

Raycast

Box

 

Force Type

The force type of the Circular Gravity Force, you can access this ether animation or through a script.

Force At Position

Force

Torque

Explosion Force

Applies force at position. As a result this will apply a torque and force on the objects.

Adds a force to the objects.

Adds a torque to the objects.

Applies a force to a objects that simulates explosion effects.

Explosion Force

Applies a force to a objects that simulates explosion effects.

 
 

Force Type

Force Type allows options for how to apply a force. Force adds a continuous force to the rigidbody, using its mass. Acceleration adds a continuous acceleration to the rigidbody, ignoring its mass. Impulse adds an instant force impulse to the rigidbody, using its mass. VelocityChange adds an instant velocity change to the rigidbody, ignoring its mass, you can access this ether animation or through a script.

Project Forward

Projects the CGF forward, only available for Spheres, Capsules, and Box shapes, also not available for Force Type Explosion Force or Torque, you can access this ether animation or through a script.

 

Force Power

Power of the force, can be negative or positive, you can access this ether animation or through a script.

Positive/Negative Force Example

Positive/Negative Force Example

 

Velocity Damping

Damps current velocity of the effected rigidbodys from the CGF, only available with Force At Position, Force,and Gravitational Attraction, you can access this ether animation or through a script.

Angular Velocity Damping

Damps current angular velocity of the effected rigidbodys from the CGF, only available with Torque, you can access this ether animation or through a script.

Max Angular Velocity Damping

Sets the max angular velocity of the effected rigidbodys from the CGF, only available with Torque.

Upwards Modifier

Adjustment to the apparent position of the explosion to make it seem to lift objects, only available with Explosion Force.

Size

Size of the CGF for SphereCapsule, and Raycast, you can access this ether animation or through a script.

Capsule Radius

Size of the Capsule radius for the CGF if using Capsule, you can access this ether animation or through a script.

Box Size

Size of the Box for the CGF if using Box, you can access this ether animation or through a script.

 

3.0 Transform Properties

Position

Allows you to override the position of the transform, helpful for when wanting a CGF object to lock in one place. You also have the option to do this ether world or local position.

Rotation

Allows you to override the rotation of the transform, helpful for when wanting a CGF object to lock its rotation. You also have the option to do this ether world or local rotation.

 

4.0 Force Position Properties

Force Position

Force position is where the CGF starts its emitting force, by default it uses This Transform. The other option is Closest Collider, where you can emit the force from a selection of colliders. NOTE: Only convex, and Unity Primitive collides work for Closest Collider.

 

Closest Colliders

Is the list of colliders you want the CGF to use when using Closest Collider for the Force Position.

Closest Collider Example

Closest Collider Example

 

Use Effected Closest Point

If toggled, this will use the closest point from the effected objects collider, to the Closest Colliders. If not then it will use the center of the effected object.

 

Height Offset

Allows you to give the Closest Collider an height offset, useful for making things hover.

Height Offset Example

Height Offset Example

 

5.0 Filter Properties

GameObject Filter

Used to filter out gameobjects, has authority over tags, colliders, physicMaterial, and layermasks.

Tag Filter

Used to filter out tags, has authority over colliders, physicMaterial, and layermasks.

Bounds Filter

Used to filter out colliders, has authority over physicMaterial, and layermasks.

Physic Material Filter

Used to filter out physic material, has authority over layermasks.

Layer Mask Filter

Used for fildering LayerMasks.

 

6.0 Event Properties

Enable Events

If enabled, you will be able to register the Event OnApplyCGFEvent which will returns the cgf used, the rigidbody it is effecting, and the collider its effecting. 

Example below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using CircularGravityForce;

public class CGFEventExample : MonoBehaviour 
{
    void Awake()
    {
        CGF.OnApplyCGFEvent += CGF_OnApplyCGFEvent;
    }

    void OnDestroy()
    {
        CGF.OnApplyCGFEvent -= CGF_OnApplyCGFEvent;
    }

    private void CGF_OnApplyCGFEvent(CGF cgf, Rigidbody rigid, Collider coll)
    {
        Debug.Log("Hello World");
    }
}
 

Enable SendMessage

If enabled, you will be able to register the SendMessage OnApplyCGF, which returns the cgf used.

Example below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using CircularGravityForce;

public class CGFSendMessageExample : MonoBehaviour 
{
    private void OnApplyCGF(CGF cgf)
    {
        Debug.Log("Hello World");
    }
}
 

7.0 Draw Gravity Properties

Draw Gravity Force

Allows you to see the CGF at runtime, drawn using Unitys Line Renderer. You have the option to select the line width, and material. 

Draw Gizmo

Allows you to toggle on and off the Editor gizmo of the CGF.

 

8.0 Memory Properties

Collider Layer Mask

This is the master Layer Mask for that CGF and will only see what you have selected under the Layer Mask.

See Colliders

This allows you to see which colliders the CGF is touching at runtime.

Non Alloc Physics

Its good to keep in mind memory allocation when using CGF over time. CGF will use memory depending on what you do, this means that when using CGF memory can play an important factor, mobile is a good example. How CGF uses memory, is in the Shape area of the CGF it looks for colliders and collects them for every FixedUpdate and checks if it needs to apply physics to it or not, over time this can use memory. If you have Non Alloc Physics turned on, it will no longer use memory over time.

Collider Buffer

When Non Alloc Physics is turned on, this is the max collider buffer size it uses, so keep in mind whatever you use, this will be the maximum number of affected objects for that CGF.

 

9.0 Effects - Align To Force

Applying Align To Force

To apply Align To Force, select the CGF you want to effect and right click the CGF Script in the Inspector and select Effects->Add ‘AlignToForce'

CGF_AlignToForce.png
 

Enable

Enable/Disable the Align To Force by using this checkbox, very useful for turning on and off the Alignment.

Align To Force Example

Align To Force Example

 

Align Direction

Allows you to select the direction of the alignment, up, down, left, right, forward, backward.

Rotate Speed

The amount of torque that is applied to the effected objects.

Angular Velocity Damping

Damps the angular velocity of the effected objects.

Use Closest Collider Height Offest

Uses and takes into consideration the Closest Collider Height Offset for the alignment.

Filter Properties

Refer to the CGF Filter Properties, works the same way.

 

10.0 Effects - No Gravity

 

Applying No Gravity

To apply No Gravity, select the CGF you want to effect and right click the CGF Script in the Inspector and select Effects->Add ’NoGravity'

CGF_Gravity.png
 

Enable

Enable/Disable the No Gravity by using this checkbox, very useful for turning on and off the the effect.

CGF_NoGravity.gif
 

Time Effected

The amount of time the No Gravity is in effect when traveling outside of the CGF.

Filter Properties

Refer to the CGF Filter Properties, works the same way.