Closest Point within a Radius...
I've spent a few days not trying to find a solution to a problem I am attempting to fix. Basically, when you are in an MMORPG you don't want to run to the direct NPCs location during an attack. You want to run the closest point within the Radius of your attack. Does anyone have a suggested formula for this?
This is what I have.
http://phpfi.com/322913
Thank you,
The closest point on the circle is on the line between you and them. Just figure out the vector from them to you, normalize it, multiply it by the radius, and add the result to their position. That's it.
Sneftel post the solution faster then me... The only thing I want to add is that in a MMORPG there are several skills and attacks and it can be difficult to know what the player want to do. What if you move the player near the NPC and the player want to cast a skill from distance?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement