nikolajp
04-14-2010, 07:31 AM
I have been reading this tutorial about a minimap.
http://udn.epicgames.com/Three/MasteringUnrealScriptInterfaces.html
I got it working quite well.
Except for the alignment of the background image on the map.
I traced the tutorial through again, and found something that doesn't make sense. I hope you can help me.
It states (to calculate the center):
7. In order to track the player’s position in the map and convert it to a position in the map texture, we need to know the range of world space coordinates in the X- and Y-axes that is covered by the map texture. Two Vector2D variables will hold these values.
var Vector2D MapRangeMin;
var Vector2D MapRangeMax;
And the code for postbegin play is then..
function PostBeginPlay()
{
Super.PostBeginPlay();
MapCenter.X = MapRangeMin.X + ((MapRangeMax.X - MapRangeMin.X) / 2);
MapCenter.Y = MapRangeMin.Y + ((MapRangeMax.Y - MapRangeMin.Y) / 2);
MapRangeMin.X = MapCenter.X - MapExtentsComponent.SphereRadius;
MapRangeMax.X = MapCenter.X + MapExtentsComponent.SphereRadius;
MapRangeMin.Y = MapCenter.Y - MapExtentsComponent.SphereRadius;
MapRangeMax.Y = MapCenter.Y + MapExtentsComponent.SphereRadius;
}
But MapRangeMax/Min is not set anywhere calculating MapCenter - I checked and its 0,0. And afterwards the MapRangeMin/Max is calculated using the MapCenter?! It doesn't make sense for me.
I tried to find a function that returns the level X/Y, but could not find it.
Anyone see the logic?
.nikolaj
http://udn.epicgames.com/Three/MasteringUnrealScriptInterfaces.html
I got it working quite well.
Except for the alignment of the background image on the map.
I traced the tutorial through again, and found something that doesn't make sense. I hope you can help me.
It states (to calculate the center):
7. In order to track the player’s position in the map and convert it to a position in the map texture, we need to know the range of world space coordinates in the X- and Y-axes that is covered by the map texture. Two Vector2D variables will hold these values.
var Vector2D MapRangeMin;
var Vector2D MapRangeMax;
And the code for postbegin play is then..
function PostBeginPlay()
{
Super.PostBeginPlay();
MapCenter.X = MapRangeMin.X + ((MapRangeMax.X - MapRangeMin.X) / 2);
MapCenter.Y = MapRangeMin.Y + ((MapRangeMax.Y - MapRangeMin.Y) / 2);
MapRangeMin.X = MapCenter.X - MapExtentsComponent.SphereRadius;
MapRangeMax.X = MapCenter.X + MapExtentsComponent.SphereRadius;
MapRangeMin.Y = MapCenter.Y - MapExtentsComponent.SphereRadius;
MapRangeMax.Y = MapCenter.Y + MapExtentsComponent.SphereRadius;
}
But MapRangeMax/Min is not set anywhere calculating MapCenter - I checked and its 0,0. And afterwards the MapRangeMin/Max is calculated using the MapCenter?! It doesn't make sense for me.
I tried to find a function that returns the level X/Y, but could not find it.
Anyone see the logic?
.nikolaj