Apply Velocity on Event LPK_ApplyVelocityOnEvent2D.cs

This component can be used to apply velocity to Rigidbody2D components when an event is received.

Suggested use:

Apply velocity in a specified direction, or towards a target when an event is received.

Download Project 5 to see how it's implemented for projectiles, by using a dummy child object as the target, and a Dispatch on Start to Owner.

Examples found in: Project 5

Components
Property Type Description Default Value
Component Properties
Velocity Application Mode Enum How to determine how velocity is applied to a game object when an event is received. TARGET = Home in on a game object. DIRECTION = Set velocity in a specific direction. DIRECTION
Velocity Application Mode - DIRECTION
Direction Vector3 Direction to set the velocity of the RigidBody2D towards. This value will be normalized. 0,0,0
Velocity Application Mode - TARGET
Target Game Object Game Object Game object to move towards. If set to null, try to find the first object with the specified tag. None
Target Tags String Tag to find a game object with to apply velocity towards.
Detect Radius Float Max distance used to search for game objects. If set to 0, detect objects anywhere. 10
Modify Rigid Body 2D RigidBody RigidBody2D component to change the velocity on. Owner RigidBody
Speed Float Speed of the force to be applied. 5
Event Receiving Info
Event Trigger LPK Event Object Which event will trigger this component's action. None
Debug Properties
Print Debug Info Boolean Toggle console debug messages. False
Label String Notes for the user about this component. This does nothing to the game or build. None