Data Realms Fan Forums
http://forums.datarealms.com/

2 small questions
http://forums.datarealms.com/viewtopic.php?f=73&t=24981
Page 2 of 2

Author:  Abdul Alhazred [ Mon Aug 08, 2011 11:50 am ]
Post subject:  Re: 2 small questions

TheLastBanana wrote:
You may want to set the third argument of SceneMan:ShortestDistance to true. Otherwise, it won't account for wrapping over the map's seam.

No. The API documentation is very clear on this:

TFM wrote:
ShortestDistance

Calculates the shortest distance between two points in scene coordinates, taking into account all wrapping and out of bounds of the two points.

Arguments:
The two Vector coordinates of the two positions to find the shortest distance between.
Whether to check if the passed in points are outside the scene, and to wrap them if they are.

Return value:

The resulting vector screen shows the shortest distance, spanning over wrapping borders etc. Basically the ideal pos2 - pos1.



So you usually don't want to set the third argument to true, because that will move e.g. Vector(0,-100) to somewhere inside the scene. It also means that using SceneMan.SceneWrapsX as the third argument, as you sometimes see people do, does not have the effect intended by the modder.

Author:  Awesomeness [ Mon Aug 08, 2011 1:53 pm ]
Post subject:  Re: 2 small questions

Okay, I'll change it to false. :P

Does anyone know what's wrong at this point?

Author:  TheLastBanana [ Mon Aug 08, 2011 8:26 pm ]
Post subject:  Re: 2 small questions

Ah, I see what you mean. I assumed that applied even if wrapping is on - a point with an x coordinate of 500 could be considered "outside" of a 400-width scene even if it wraps horizontally, as that's how the wrapping argument works on, for instance, CastWeaknessRay. It looks like you're right, though, so thanks for clearing that up.

Page 2 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/