Forum rules - please read before posting.

2D - Camera following mouse cursor

Hi,

Instead of the gamecamera following the player is it possible to follow the mouse cursor?

Best regards,
LH

Comments

  • Welcome to the community, @henrikes.

    The following code will cause a GameObject to follow your cursor in 2D space:
    http://pasteall.org/944549/csharp

    Paste it into a C# script named FollowCursor.cs, and add it to a GameObject in your scene (you may want to also attach a sprite so that you can visualise it while testing).

    Then in your 2D GameCamera, uncheck Target is Player? and assign this new GameObject as the new Target field that appears beneath.
  • Thank you, for both the welcome and the help :)

    I will try to do what you say :)
  • Worked like a charm :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.