Object Edges 2D
Tutorial / Demo
Object Edges 2D allows you to move unity game objects without worrying about game object scale, collider size, offset, or sprite pivot.
you can simply write:
player. Move Bottom Left To ( Ground . Get Top Left());
you can simply write:
player. Move Bottom Left To ( Ground . Get Top Left());
Your player have multiple parts ?
Supported Types
supports
- Sprite Renderer
- Box Collider 2D
- Circle Collider 2D
- Sprite Renderer
- Box Collider 2D
- Circle Collider 2D
Documentation
To call get or move method, simply get a references to the object SpriteRenderer, BoxCollider2D, or CircleCollider2D then call the required method from that object.
Example:
myBoxCollider2D. MoveBottomLeft To ( groundSpriteRenderer.GetTopRight());
Example:
myBoxCollider2D. MoveBottomLeft To ( groundSpriteRenderer.GetTopRight());
Get Methods
Signature:
- Vector3 Get...()
usage:
all get methods return the object pivot position as vector 3.
Example:
Vector3 boxTopRight = myBoxCollider.GetTopRight();
Get Methods List:
GetTopLeft()
GetTopCenter()
GetTopRight()
GetLeftCenter()
GetCenter()
GetRightCenter()
GetBottomLeft()
GetBottomCenter()
GetBottomRight()
- Vector3 Get...()
usage:
all get methods return the object pivot position as vector 3.
Example:
Vector3 boxTopRight = myBoxCollider.GetTopRight();
Get Methods List:
GetTopLeft()
GetTopCenter()
GetTopRight()
GetLeftCenter()
GetCenter()
GetRightCenter()
GetBottomLeft()
GetBottomCenter()
GetBottomRight()
Move Methods
Method Signatures
1. first signature:
Vector3 Move...( Vector3 targetPosition)
parameters:
- it accepts the target position as vector 3
- it returns the distance the gameObject moved as Vector3
usage:
simply call any supported type.Move...(targetPosition)
Example:
myCircleCollider.MoveBottomLeftTo( startPosition);
2. second signature:
Vector3 Move...( Vector3 targetPosition , optional GameObject topParent)
usage:
- this method is the same at the previous one, but it moves all the top parent game object instead of the game object that called the method.
- it is useful when your gameObject has multiple parts and you want to move him using his foot or wheel.
- Example:
Vector3 Move...( Vector3 targetPosition)
parameters:
- it accepts the target position as vector 3
- it returns the distance the gameObject moved as Vector3
usage:
simply call any supported type.Move...(targetPosition)
Example:
myCircleCollider.MoveBottomLeftTo( startPosition);
2. second signature:
Vector3 Move...( Vector3 targetPosition , optional GameObject topParent)
usage:
- this method is the same at the previous one, but it moves all the top parent game object instead of the game object that called the method.
- it is useful when your gameObject has multiple parts and you want to move him using his foot or wheel.
- Example:
Move Methods List
MoveTopLeftTo()
MoveTopCenterTo()
MoveTopRightTo()
MoveLeftCenterTo()
MoveCenterTo()
MoveRightCenterTo()
MoveBottomLeftTo()
MoveBottomCenterTo()
MoveBottomRightTo()
MoveTopCenterTo()
MoveTopRightTo()
MoveLeftCenterTo()
MoveCenterTo()
MoveRightCenterTo()
MoveBottomLeftTo()
MoveBottomCenterTo()
MoveBottomRightTo()
Love this asset ? then you will love :
1. Camera Edges Asset
2. Directional Zoom
Zoom only in the direction you want
Asset Page
Asset Page