Talk:GetDistance

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Unit to Feet Conversion[edit source]

Can someone please post a rough idea of the scale. For example, what approximate distance is 3000 units in feet? Sockmonkeh 21:51, 4 April 2006 (EDT)

JBurgess 00:15, 5 April 2006 (EDT) 00:15, 5 April 2006 (EDT) We meet again. The units we use are (as far as I can tell) arbitrary. Rather than work out conversions, I usually place a light actor and toggle Radii on with the L hotkey. Lights usually end in their radius, so it's easy to drop one in to test a rough distance, or alternately keep a test light with a radius you change as a constant yardstick. Hope this helps.
--Kkuhlmann 10:54, 5 April 2006 (EDT): I have a note written in the corner of my whiteboard: 20 units/ft. For whatever that's worth...
Dragoon Wraith TALK 13:29, 1 June 2006 (EDT): See the Oblivion Units article that I wrote: A character of height 1.0 is 128 units tall. Assuming that this character is 6 feet tall, that's 21 and a third units per feet, so GetDistance*21.3333 should give you their distance in feet, pretty nearly. 20units/foot will give you a character of greater than 6 feet tall, which strikes me as unlikely for the "average" height.

Syntax Question[edit source]

--MaXiMiUS 23:52, 30 April 2006 (EDT) Could somebody tell me if this is proper syntax use: player.GetDistance OwnerRef2 ? (It should be "Player's distance from OwnerRef2")..

Dragoon Wraith TALK 13:29, 1 June 2006 (EDT): Yes, that's correct.

Within One Cell Only[edit source]

--Elessar VPR 11:56, 1 June 2006 (EDT) The GetDistance function is only reliable within a worldspace. By that I mean if you try and call GetDistance between two references that are in different worldspaces (ie. Tamriel, City World Spaces and Interiors...), then the returned value will be the maximum value the integer used can hold (eg 32767 for short). Within the same worldspace/interior the function works fine

Dragoon Wraith TALK 13:29, 1 June 2006 (EDT): Well, that makes sense, I wouldn't expect the game to be able to figure that out (though it would be amazingly cool if it could!). Your best bet then is to use this:
if ( GetInSameCell == 1 )
  GetDistance
else
  ;out of range, or something
endif
Though, depending on how you have this working, you could conceivably have an object track a character until he reaches a loaddoor, and record the distance between the loaddoor and the object in that cell, and then on the other side of the door record the distance between the loaddoor the character came through and the character, and add the two together. This would actually give a more realistic distance between the two, but that may not be desired - the straight-line distance between the two objects is probably impossible to get, unless you want to mess with annoying trigonometry and GetHeadingAngle, though in theory that might work too (depends on the different cells being aligned properly, which not all are).