Jump to content

how to make the player look at an object?


Gaimo

Recommended Posts

Posted

I'm making a resource zipline and I'd like to make the player look in the right direction when he starts moving, any idea how to do that?

I would also like to know if there is an animation that looks like the player is using a zipline.

Demo:

 

Posted
Quote

function findRotation(x1,y1,x2,y2)
    local t = -math.deg(math.atan2(x2-x1,y2-y1))
    if t < 0 then t = t + 360 end;
    return t;
end

 

  • Like 1
Posted (edited)
30 minutes ago, Gaimo said:

Very good animation, thanks!

 

You're welcome, let us know if you need some other help too with the script.

Edited by Flashmyname

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...