question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add 2D Follow Script

See original GitHub issue

Follow Utility.

We should be able to attach it to any object that we want follows another object.

This follow script can have these settings:

  • offset (Vector3): The position offset for the follower.
  • followType (Enum): MoveTowards, Lerp, SmoothDamp and Acceleration Enum, Also each follow type has it’s own settings.
public enum FollowType {
  MoveTowards,
  Lerp,
  Slerp,
  SmoothDamp,
  Acceleration
}
  • speed (You can use it where you need it): The speed of the follower.
  • time (You can use it where you need it for Lerp, MoveTowards, …): The time for movement, Also you can use it as smooth time for SmoothDamp.
  • bounds (Bounds, BoxCollider2D, Vector2, …): Can be anything, a width and height or a box collider 2d or an bounds class, also there should be an option to disable it.

EDIT: Acceleration movement http://answers.unity3d.com/answers/29757/view.html

Any more suggestions are welcome. 😄

Looking for Rigidbody2D follow script? Find it at #13

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hasanbayatmecommented, Jul 19, 2017

Acceleration follow means the object increases speed over time. Gradually moving an object.

Here is a nice resource: http://answers.unity3d.com/answers/29757/view.html

Resource Added to issue.

Thanks.

1reaction
Lootheocommented, Jul 18, 2017

Sounds like a fun thing to check, I’ll give it a try today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unity 2d camera follow script, add this ...
unity 2d camera follow script, add this script to camera and drag character or your object into it. simple! - unity 2d camera...
Read more >
Unity 2D Platformer Tutorial 18 - Making the camera follow the ...
This video demonstrates how to write a script to make the camera follow the player in a 2D platformer game in Unity. Code...
Read more >
Make a Unity 2D Camera Follow Player in 15 seconds
In this 15 second Unity tutorial, we cover how to make a unity 2d camera follow player. ▻ Socials Twitter: https://twitter.com/the_real_aia ...
Read more >
How to Add a 2D Follow Camera in Unity 2022 - YouTube
Quick updated guide on how to setup a camera that follows your player around the screen and sets up pixel perfect camera with...
Read more >
Unity 2D Platformer Tutorial 7 - YouTube
Unity 2D Platformer Tutorial 7 - How To Create 2D Smooth Camera Follow Script For Your Player · Comments321.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found