kinggath Posted September 10, 2016 Posted September 10, 2016 I found what I believe is a bug in the way Papyrus handles the GetDistance function. Let's say you have a RefCollectionAlias Property pointing to a Quest RefCollectionAlias filled with random ObjectReferences. If you loop through it with while grabbing each reference with GetAt and do a distance check to each on some other ObjectReference - the order matters, if you use the alias reference on the left, you'll get an impossibly huge number, while if you use it as the parameter, you'll get a correct distance. Here's some code to show what I mean: int i = 0 while(i < SomeRefCollection.GetCount()) ObjectReference thisRef = SomeRefCollection.GetAt(i) as ObjectReference float thisRefOnLeft = thisRef.GetDistance(someOtherReference) float thisRefOnRight = someOtherReference.GetDistance(thisRef) i += 1 endWhile Even though, those should come out to the same distance, thisRefOnLeft will have a crazy large number as if the two objects are in different worldspaces, and thisRefOnRight will have a correct distance. I still need to test this in a blank mod to confirm that this isn't just conflicts within my scripts, but I'm heading out right now, so I'll have to follow up later - thought I'd post this now in case someone can explain to me why this happens, or as a helper for anyone else who runs into the issue.
deadbeeftffn Posted September 11, 2016 Posted September 11, 2016 So, this is interesting. I tried to use GetDistance() to measure the distance between an Actor and an ObjectReference and i observed the same problem. Using distance = theActor.GetDifference(theObject)sometimes work and sometimes returning ridiculous numbers. Whereas distance = theObject.GetDistance(theActor) seems to always return the correct distance. Thanks a lot for the hint :-)
Deathlock47 Posted January 31, 2017 Posted January 31, 2017 funny story, I flipped it the so the actor is second and now im getting distance 0
Recommended Posts