- Sistema de coordenadas.
- Diferentes espacios. (local y global).
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
General (Antiguo) / sistemas de coordenadas unity
Marzo 10, 2016, 05:26:03 PMGeneral (Antiguo) / sistemas de coordenadas unity
Marzo 10, 2016, 05:08:32 PMGeneral (Antiguo) / ayuda con la transparencia
Febrero 25, 2016, 06:46:15 PMGeneral (Antiguo) / ayuda con la transparencia
Febrero 25, 2016, 05:28:00 PMfor (int i = 0; i < rend.materials.Length; i++)
{
if (rend.materials.color.a < 1)
{
rend.materials.shader = Shader.Find("Transparent/Diffuse");
}
else
rend.materials.shader = Shader.Find("Diffuse");
if (rend.materials.color.a > 0.5f)
{
Color cor = rend.materials.color;
cor.a -= 0.02f;
rend.materials.color = cor; }
else { if (rend.materials.color.a < 1)
{
Color cor = rend.materials.color;
cor.a += 0.02f;
rend.materials.color = cor; }
}
}
General (Antiguo) / Necesito ayuda para poner transparente una imagen
Febrero 09, 2016, 05:42:05 PMesfera.transform.position = new Vector3(9, -7, 0.08F);
esfera.AddComponent<ReverseNormals>();
string phrase = "ascii_panoramas000000";
rend = esfera.GetComponent<Renderer>();
rend.material.mainTexture = Resources.Load("texturas/" + phrase) as Texture; cam1.SetActive(true);
cam1.transform.position = new Vector3(9, -7, 0.08F);
cam1.AddComponent<rotar>(); Pero no se como ahora esa textura ponerla trasparente ahi pongo algo q uso pero no me funciona, por eso pido q me ayuden....void Update () { if (Input.GetKeyDown(KeyCode.D))
{
//gameObject.renderer.material.color = Color32(Red, Green, Blue, Alpha);
esfera.renderer.material.color = Color32(Red, Green, Blue, Alpha);}
}
General (Antiguo) / Transparencia de texturas para ver modelo 3d
Febrero 09, 2016, 11:40:05 AMvoid GenerarEsferas()
{
int index = 0;
foreach (Panorama p in Registros1)
{ if (index % 2 == 0)
{
GameObject esfera = GameObject.CreatePrimitive(PrimitiveType.Sphere);
esfera.transform.position = new Vector3((float)p.x, 0, (float)p.z);
esfera.AddComponent<ReverseNormals>();
//Escala de los panoramas
esfera.transform.localScale = new Vector3(0.025F, 0.025F, 0.025F);
//Poner textura
String phrase = p.file_name;
phrase = phrase.Replace(".jpg", "");
Renderer rend = esfera.GetComponent<Renderer>();
rend.material.mainTexture = Resources.Load("texturas/" + phrase) as Texture;
// Debug.Log(p.file_name); } index = index + 1; }
} Yo tambien tengo una función Recorrido, que va moviendo la camara por todas las posiciones de las esferas pintadas, viendo las imagenes panoramicas a 360 grados q lleva cada esfera como textura, pero lo que necesito es ahora mediante un evento (Que seria una tecla del teclado) que la textura se haga transparente, para ver el modelo 3D de la posición donde me encuentro y hacer invisibles las demás, por eso necesito que me ayudes orientandome. Yo estuve viendo estas propiedas en el editor con una textura Alpha fron Graycal y hace trasparente la textura, pero necesito verlo mediante código para ver si algo como esto me sirve para lo que necesito.
General (Antiguo) / Transparencia de texturas para ver modelo 3d
Febrero 08, 2016, 10:28:28 AMGeneral (Antiguo) / Transparencia de texturas para ver modelo 3d
Febrero 05, 2016, 05:24:32 PMGeneral (Antiguo) / problemas con el script
Enero 14, 2016, 07:17:56 PMGeneral (Antiguo) / problemas con el script
Enero 14, 2016, 06:26:16 PMGeneral (Antiguo) / problemas con el script
Enero 14, 2016, 06:15:40 PM
General (Antiguo) / problemas con el script
Enero 14, 2016, 04:22:20 PMGeneral (Antiguo) / problemas con el script
Enero 14, 2016, 12:28:19 PMusing UnityEngine; using System.Collections; [RequireComponent(typeof(MeshFilter))] public class ReverseNormals : MonoBehaviour { void Start() { MeshFilter filter = GetComponent(typeof(MeshFilter)) as MeshFilter; if (filter != null) { Mesh mesh = filter.mesh; Vector3[] normals = mesh.normals; for (int i = 0; i < normals.Length; i++) normals = -normals; mesh.normals = normals; for (int m = 0; m < mesh.subMeshCount; m++) { int[] triangles = mesh.GetTriangles(m); for (int i = 0; i < triangles.Length; i += 3) { int temp = triangles[i + 0]; triangles[i + 0] = triangles[i + 1]; triangles[i + 1] = temp; } mesh.SetTriangles(triangles, m); } } } } Y se lo asignaba a un gameobject de tipo esfera que yo tenia en la escena y funcionaba super bien. Pero ahora necesito desde un script crear la esfera y que se inviertan sus normales y lo he tratado de hacer asi y no me funciona lo de la funcion InvertirNormales miren ahi les pongo el codigo a ver que puedo hacer para que me funciones todo desde el escript: GameObject esfera = GameObject.CreatePrimitive(PrimitiveType.Sphere); esfera.transform.position = new Vector3((float) p.x, 0, (float) p.z); Renderer rend = esfera.GetComponent<Renderer>(); rend.material.mainTexture = Resources.Load("texturas/"+ p.file_name) as Texture; InvertirNormales(esfera.GetComponent<MeshFilter>()); //funcion de invertir normales void InvertirNormales(MeshFilter filter) { //MeshFilter filter = GetComponent(typeof(MeshFilter)) as MeshFilter; if (filter != null) { Mesh mesh = filter.mesh; Vector3[] normals = mesh.normals; for (int i = 0; i < normals.Length; i++) normals = -normals; mesh.normals = normals; for (int m = 0; m < mesh.subMeshCount; m++) { int[] triangles = mesh.GetTriangles(m); for (int i = 0; i < triangles.Length; i += 3) { int temp = triangles[i + 0]; triangles[i + 0] = triangles[i + 1]; triangles[i + 1] = temp; } mesh.SetTriangles(triangles, m); } } } }