You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.txt
+1-56Lines changed: 1 addition & 56 deletions
Original file line number
Diff line number
Diff line change
@@ -2,59 +2,4 @@
2
2
-cleaned up comments
3
3
-cleaned up some "test" files
4
4
-updated linux stuff
5
-
-rotation texture error (bird's eye):
6
-
-1 = top
7
-
-2 = bottom
8
-
-3 = west
9
-
-4 = east
10
-
-5 = north
11
-
-6 = south
12
-
13
-
## stole this from sledge. let's have a look at what this means
14
-
15
-
public void AlignTextureToWorld()
16
-
{
17
-
// Set the U and V axes to match the X, Y, or Z axes
18
-
// How they are calculated depends on which direction the plane is facing
19
-
20
-
var direction = Plane.GetClosestAxisToNormal();
21
-
22
-
// VHE behaviour:
23
-
// U axis: If the closest axis to the normal is the X axis,
24
-
// the U axis is UnitY. Otherwise, the U axis is UnitX.
25
-
// V axis: If the closest axis to the normal is the Z axis,
26
-
// the V axis is -UnitY. Otherwise, the V axis is -UnitZ.
27
-
28
-
Texture.UAxis = direction == Coordinate.UnitX ? Coordinate.UnitY : Coordinate.UnitX;
29
-
Texture.VAxis = direction == Coordinate.UnitZ ? -Coordinate.UnitY : -Coordinate.UnitZ;
30
-
Texture.Rotation = 0;
31
-
32
-
CalculateTextureCoordinates(true);
33
-
}
34
-
# what it references
35
-
## plane.get
36
-
public Coordinate GetClosestAxisToNormal()
37
-
{
38
-
// VHE prioritises the axes in order of X, Y, Z.
39
-
var norm = Normal.Absolute();
40
-
41
-
if (norm.X >= norm.Y && norm.X >= norm.Z) return Coordinate.UnitX; ##IF DISTANCE FROM X is grequal THAN Y AND Z furthest is X
42
-
if (norm.Y >= norm.Z) return Coordinate.UnitY;
43
-
return Coordinate.UnitZ;
44
-
}
45
-
### coordinate.unit x/y/z
46
-
public readonly static Coordinate UnitX = new Coordinate(1, 0, 0);
47
-
public readonly static Coordinate UnitY = new Coordinate(0, 1, 0);
48
-
public readonly static Coordinate UnitZ = new Coordinate(0, 0, 1);
49
-
50
-
51
-
FROM WHAT I GLEAM
52
-
53
-
the "normal" is the midpoint of a side. so if it's closest to the x axis, the uaxis variable will look like "uaxis" "[0 1 0 1] 0.25".
54
-
otherwise, it's "uaxis" "[-1 0 0 1] 0.25"
55
-
56
-
if the normal is closest to the Z axis, the vaxis variable is "uaxis" "[0 -1 0 1] 0.25". otherwise it's "uaxis" "[0 0 -1 1] 0.25"
57
-
58
-
what we can do to calculate the norm for each side is go through each variable side (each side is xyz1,xyz2,xyz3 and so on) and get the normal for each, then calculating what uaxis and vaxis should be used. I reckon the tough part might be replacing the u and vaxis variables in the string, but we can probably use a .replace() with a times replaced as 1. Also, that might be a bit tough since we don't know what exactly the uaxis/vaxis values are.
59
-
60
-
TO FIND THE NORMAL: http://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfPlanes.aspx
normal = (vector_a[1]*vector_b[2]-vector_a[2]*vector_b[1],vector_a[2]*vector_b[0]-vector_a[0]*vector_b[2],vector_a[0]*vector_b[1]-vector_a[1]*vector_b[0])
normal = (vector_a[1]*vector_b[2]-vector_a[2]*vector_b[1],vector_a[2]*vector_b[0]-vector_a[0]*vector_b[2],vector_a[0]*vector_b[1]-vector_a[1]*vector_b[0])
0 commit comments