Estimados,
Primero buenos días! No se si este es el foro indicado para publicar esto, pero aun no me habilitan el resto.
Mi problema es el siguiente, estamos desarrollando un juego de disparos, en Unity3d, en el cual se pueden generar reportes en Pdf de los tiros que hemos hecho.
Mediante el siguiente código saco las medidas y posición de la Diana de tiro en pantalla:
public float[] getPositionObject(GameObject gameObject, Camera camera)
{
float depth = gameObject.transform.lossyScale.z;
float width = gameObject.transform.lossyScale.x;
float height = gameObject.transform.lossyScale.y;
Vector3 gpSize = gameObject.GetComponent<Renderer> ().bounds.size;
float[] posiciones = new float[4];
Vector3 lowerLeftPoint = camera.WorldToScreenPoint( new Vector3( gameObject.transform.position.x - (gpSize.x / 2), gameObject.transform.position.y - (gpSize.y / 2), gameObject.transform.position.z - (gpSize.z / 2)) );
Vector3 upperRightPoint = camera.WorldToScreenPoint( new Vector3( gameObject.transform.position.x + (gpSize.x / 2), gameObject.transform.position.y + (gpSize.y / 2), gameObject.transform.position.z - (gpSize.z / 2) ) );
Vector3 upperLeftPoint = camera.WorldToScreenPoint( new Vector3( gameObject.transform.position.x - (gpSize.x / 2), gameObject.transform.position.y +