[ad_1]
The means I did this was to maintain a marker within the centre of the minimap masks, and rotate the marker with the participant. The motion of the minimap can simply be moved with the size of the map. Example:
Marker:
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
public class UIMarker : MonoBehaviour
{
public CarController van;
public float yRotation;
personal Vector3 eulerRotation;
personal Quaternion rotation;
// Update is known as as soon as per body
void Update()
{
// Getting Y rotation of the van (course going through)
yRotation = van.vanRotation.eulerAngles.y + 90;
// turning that right into a vector for rotation of airplane (in Z as rotation of map is on a unique airplane to van)
eulerRotation = new Vector3(0, 0, -yRotation);
// changing euler angles into quaternion
rotation.eulerAngles = eulerRotation;
rework.rotation = rotation;
}
}
Minimap:
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing UnityEngine.UI;
public class UIMinimap : MonoBehaviour
{
public CarController van;
public float screenHeight;
public float screenWidth;
personal float xOffset;
personal float yOffset;
personal float yMovement;
personal float xMovement;
public float yScale;
public float xScale;
public Vector2 Movement;
void Start()
{
// getting offset which adjustments with display screen dimension
xOffset = rework.place.x;
yOffset = rework.place.y;
// declaring the display screen width and top
screenHeight = Screen.top;
screenWidth = Screen.width;
// dividing the peak/width of a display screen by an element that adjusts for the size of the map
yScale = screenHeight / 1675;
xScale = screenWidth / 3350;
}
void FastenedUpdate()
{
// changing the place of the van on the true map to motion of the picture, motion is set by the size
// of the minimap to the precise terrain, whereas x and y offset change with display screen dimension so should be declared and added
yMovement= (van.rework.place.x * yScale) + yOffset;
xMovement = (-van.rework.place.z * xScale) + xOffset;
Movement = new Vector2(xMovement, yMovement);
rework.place = Movement;
}
}
This is unquestionably not probably the most elegant answer, however works properly sufficient for my functions
[ad_2]