ApplyForce2DAction - CodingDino/Dino-Unity-Toolkit GitHub Wiki

The ApplyForce2DAction component adds a force to a Rigidbody2D component attached to the same GameObject. The result is a "push" in the direction of the force - this might be used for jumping, throwing an item, hitting / breaking something, etc. When you attach this component, the Rigidbody2D will automatically be attached as well. You will not be able to remove the Rigidbody2D component while the ApplyForce2DAction is attached.

This is an Action component, and therefore must be triggered by a separate Activator component. Actions, Activators, and Data make up the core system for the Dino Unity Toolkit.

Image: ApplyForce2DAction attached to a player.

Image: ApplyForce2DAction attached to a square which applies a positive y force when a button is pressed using an InputButtonActivator.

Actions

This component has several Action functions that can be triggered by Activators.

ActionApplyForce()

This will apply a force to the RigidBody in both the x and y directions, using a vector.

Parameter: Description:
Force To Apply Both the x and y components of the force to be applied.

ActionApplyXForce()

This will apply a force to the RigidBody in only the x direction.

Parameter: Description:
X Force To Apply The amount of force to be applied, in the x direction.

ActionApplyYForce()

This will apply a force to the RigidBody in only the y direction.

Parameter: Description:
Y Force To Apply The amount of force to be applied, in the y direction.