Home>
I want to correct the displacement of Graphics.DrawMesh coordinates
Applicable source codeusing System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Drawmesh: MonoBehaviour
{
Mesh planeMesh;
public Material material;
Mesh NewPlaneMesh ()
{
Vector3 [] array = new Vector3 [4];
Vector2 [] array2 = new Vector2 [4];
int [] array3 = new int [6];
array [0] = new Vector3 (0, 0, 1);
array [1] = new Vector3 (0, 1, 1);
array [2] = new Vector3 (1, 0, 1);
array [3] = new Vector3 (1, 1, 1);
array2 [0] = new Vector2 (0, 0);
array2 [1] = new Vector2 (0, 1);
array2 [2] = new Vector2 (1, 0);
array2 [3] = new Vector2 (1, 1);
array3 [0] = 0;
array3 [1] = 1;
array3 [2] = 2;
array3 [3] = 1;
array3 [4] = 3;
array3 [5] = 2;
Mesh mesh = new Mesh ();
mesh.name = "NewPlaneMesh ()";
mesh.vertices = array;
mesh.uv = array2;
mesh.SetTriangles (array3, 0);
mesh.RecalculateNormals ();
mesh.RecalculateBounds ();
return mesh;
}
Mesh PlaneMesh
{
get
{
if (planeMesh == null)
{
planeMesh = NewPlaneMesh ();
}
return planeMesh;
}
}
Quaternion quaternion = Quaternion.Euler (0, 0, 180);
private void Update ()
{
Graphics.DrawMesh (PlaneMesh, Vector3.one, Quaternion.identity, material, 0);
Graphics.DrawMesh (PlaneMesh, Vector3.one, quaternion, material, 0);
}
}
The Quaternion.identity and Quaternion are specified and drawn twice, but the coordinates specifying the Quaternion are misaligned even though the coordinates are the same for some reason. . Why is this? I asked a question because I didn't understand it. Answer please.
-
Answer # 1
Related articles
- c # - player production in unity (shooting game)
- [c # unity] how to set arrey or dictionary in scriptableobject?
- c # - about unity ads test ad display
- c # - unity 202010f1 + oculusrift hmd position tracking is not reflected in the game
- about programming basics unity c #
- c # - [unity ray cast] execute the function of the object that received the ray
- c # - [unity 2d] i want to create a gimmick that clings to a rope, hangs, swings like a pendulum, and jumps
- c # - about player prefs for unity
- [unity c #] how to completely stop walking when switching panels
- how to use tolist (): and linq;in unity c #
- c # - when controlling ui in unity, there are times when you can access an instance of an object and times when you cannot
- c # - unity) show/hide prefab button conditionally
- c # - how to autorun after burning unity to dvd
- c # - i want to know the file format that unity can call an external process in android environment
- c # - [unity] i want to pass a variable from onenddrag to ondrop
- c # - [unity] on the game screen, right-click menu display when an object is selected and when it is not selected
- c # - unity child objects reset method to initial position
- learn how to study c # with unity
- [unity, c #] how to specify the top object
- c # - object duplication script in unity 2d
Related questions
- c # - player production in unity (shooting game)
- c # - unity) fb storage android device test doesn't work
- c # - unity) pocketbook structure
- c # - i want to slowly rotate the model to a fixed angle when the flag is set, and slowly return it to the original angle when t
- c # - i want to display high score and score in unity
- c # - error in nav mesh agent
- c # - i want to call a method of another script in unity, but it doesn't work
- c # - how to get components in unity
- c # - the car with wheelcollider does not hit the stage
- c # - i want the player to follow the camera (3d)
If rotating, rotate around (0,0) coordinates
The tree picture is in the area (0,0)-(1,1), so I think it just rotates around the bottom left