![]() |
Getting the angle between a npc to player.
I'm not the greatest when it comes to math but I was wondering is there a function to get the angle between a player and an npc through gscript?
|
First find the delta like so:
temp.dx = ((player.x+1.5) - (npc.x+1.5)); temp.dy = ((player.y+2) - (npc.y+2)); The offset is 1.5x2, which is the center of the player objects. If the NPC is not a player character and has a different body shape, you'll want to adjust that accordingly. Then use the getangle() function: getangle(dx,dy); By the by, Graal uses radials(0-pi*2) and not degrees(0-360). |
If you're familiar with trigonometry, getangle(dx, dy) is just atan2.
|
After I graduated in '06 everything in my head went into the 'Recycle Bin'. haha
|
Quote:
|
Quote:
|
My 'recycle bin' is full of things I learnt before graduating too :mad:
|
Quote:
|
I don't even remember what I learned last grade. I can't imagine how much of a ******* I'll be when I graduate in June.
|
The only thing that my brain registers is video games, beer and food.
|
| All times are GMT +2. The time now is 07:35 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.