Difference between revisions of "Talk:GetDistance - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rasikko
(Created page with "Seems like this function takes the x position of both objects and subtracts them, using the difference as the distance. However upon testing this, the math doesn't quite agree...")
 
imported>Rasikko
m (Uses the pythagorean theorem distance formula.)
Line 1: Line 1:
Seems like this function takes the x position of both objects and subtracts them, using the difference as the distance. However upon testing this, the math doesn't quite agree - I'm off by at least 10 units. --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-27T15:22:59 (EDT)
This function uses the Pythagorean Theorem based distance formula. The function most likely has to first convert the x and y positions to coordinates. Then adjust any negative coordinates to match up with their counterparts in the CK(in game they are offset by 1), and using the formula will lead to possibly calling [[Sqrt - Math]] under the hood. Having said that, while not totally necessary, you can code your own GetDistance function --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-28T08:55:45 (EDT)

Revision as of 07:56, 28 May 2018

This function uses the Pythagorean Theorem based distance formula. The function most likely has to first convert the x and y positions to coordinates. Then adjust any negative coordinates to match up with their counterparts in the CK(in game they are offset by 1), and using the formula will lead to possibly calling Sqrt - Math under the hood. Having said that, while not totally necessary, you can code your own GetDistance function --Rasikko (talk) 2018-05-28T08:55:45 (EDT)