Hi All,
I'm having a decal mesh( a quad) which has a shadow texture. and I have a bike, which has its forward direction, I have the normal to the ground, and normal touching point to ground. I have also the direction of light.
My quad on the floor has 4 vertices, so I assumed as the figure Points C,D is set to be parallel with the front wheel and the back wheel.
I would like to get the maths and get the points A, B with respect to the light direction.
My current code is : I would like to determine both vxPosSide2, and VxPosSide3
Quaternion rot = Quaternion.AngleAxis(Source.rotation.eulerAngles.y, normal) * Quaternion.FromToRotation(new Vector3(0, 1, 0), normal);
Vector3 pos = point + new Vector3(0, 0.1f, 0);
Color32 colorSideTexture = mRenderer.sharedMaterial.GetColor("_Color");
Vector3 vxPos1Side = pos + rot * (new Vector3(-1.4f, 0, -0.7f) * scale);
Vector3 vxPos2Side = pos + rot * (new Vector3(0, 0, -0.7f) * scale);
Vector3 vxPos3Side = pos + rot * (new Vector3(0, 0, 0.7f) * scale);
Vector3 vxPos4Side = pos + rot * (new Vector3(-1.4f, 0, 0.7f) * scale);
mDecalSide.SetVertex(0, vxPos1Side, colorSideTexture);
mDecalSide.SetVertex(1, vxPos2Side, colorSideTexture);
mDecalSide.SetVertex(2, vxPos3Side, colorSideTexture);
mDecalSide.SetVertex(3, vxPos4Side, colorSideTexture);