Making an image face a point
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- SamPerson12345
- Prole
- Posts: 41
- Joined: Sat Aug 30, 2008 5:35 pm
Making an image face a point
I'm making a top down shooter and I wanted the player image to face the cross hair. The problem is I have no idea how to get an angle with two points. Can someone please help?
Re: Making an image face a point
Use this math:
We need lua syntaxing code boxes!
Code: Select all
local x2, y2 = position
local x1, y1 = position
local ang = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
- SamPerson12345
- Prole
- Posts: 41
- Joined: Sat Aug 30, 2008 5:35 pm
Re: Making an image face a point
Thanks for that .
Who is online
Users browsing this forum: Bing [Bot] and 5 guests