Skip to content

Commit c2098fd

Browse files
lvonasekmicrosoft-github-policy-service[bot]keveleighRogPodge
authored
Bounding box of SkinnedMeshRenderer support added (#10611)
* Microsoft mandatory file (#10599) Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com> * Bounding box of SkinnedMeshRenderer support added * Bounding box of SkinnedMeshRenderer support added Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com> Co-authored-by: Kurtis <[email protected]> Co-authored-by: RogPodge <[email protected]>
1 parent 121a679 commit c2098fd

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

Assets/MRTK/SDK/Features/UX/Scripts/BoundingBox/BoundingBox.cs

+18
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,19 @@ private Bounds GetMaxBounds(GameObject g)
15811581
b.Encapsulate(currentMesh.bounds);
15821582
}
15831583
}
1584+
foreach (SkinnedMeshRenderer r in g.GetComponentsInChildren<SkinnedMeshRenderer>())
1585+
{
1586+
if ((currentMesh = r.sharedMesh) == null) { continue; }
1587+
1588+
if (b.size == Vector3.zero)
1589+
{
1590+
b = currentMesh.bounds;
1591+
}
1592+
else
1593+
{
1594+
b.Encapsulate(currentMesh.bounds);
1595+
}
1596+
}
15841597
return b;
15851598
}
15861599

@@ -1888,10 +1901,15 @@ private void ExtractBoundsCorners(Transform childTransform, BoundsCalculationMet
18881901
if (boundsCalculationMethod != BoundsCalculationMethod.ColliderOnly)
18891902
{
18901903
MeshFilter meshFilter = childTransform.GetComponent<MeshFilter>();
1904+
SkinnedMeshRenderer skinnedMeshRenderer = childTransform.GetComponent<SkinnedMeshRenderer>();
18911905
if (meshFilter != null && meshFilter.sharedMesh != null)
18921906
{
18931907
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>(childTransform, meshFilter.sharedMesh.bounds);
18941908
}
1909+
else if (skinnedMeshRenderer != null && skinnedMeshRenderer.sharedMesh != null)
1910+
{
1911+
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>(childTransform, skinnedMeshRenderer.sharedMesh.bounds);
1912+
}
18951913
else
18961914
{
18971915
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>();

Assets/MRTK/SDK/Features/UX/Scripts/BoundsControl/BoundsControl.cs

+5
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,15 @@ private void ExtractBoundsCorners(Transform childTransform, BoundsCalculationMet
950950
if (boundsCalculationMethod != BoundsCalculationMethod.ColliderOnly)
951951
{
952952
MeshFilter meshFilter = childTransform.GetComponent<MeshFilter>();
953+
SkinnedMeshRenderer skinnedMeshRenderer = childTransform.GetComponent<SkinnedMeshRenderer>();
953954
if (meshFilter != null && meshFilter.sharedMesh != null)
954955
{
955956
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>(childTransform, meshFilter.sharedMesh.bounds);
956957
}
958+
else if (skinnedMeshRenderer != null && skinnedMeshRenderer.sharedMesh != null)
959+
{
960+
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>(childTransform, skinnedMeshRenderer.sharedMesh.bounds);
961+
}
957962
else
958963
{
959964
rendererBoundsByTransform = new KeyValuePair<Transform, Bounds>();

Assets/MRTK/SDK/Features/UX/Scripts/BoundsControl/Visuals/VisualUtils.cs

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ internal static Bounds GetMaxBounds(GameObject g)
5151
b.Encapsulate(currentMesh.bounds);
5252
}
5353
}
54+
foreach (SkinnedMeshRenderer r in g.GetComponentsInChildren<SkinnedMeshRenderer>())
55+
{
56+
if ((currentMesh = r.sharedMesh) == null) { continue; }
57+
58+
if (b.size == Vector3.zero)
59+
{
60+
b = currentMesh.bounds;
61+
}
62+
else
63+
{
64+
b.Encapsulate(currentMesh.bounds);
65+
}
66+
}
5467
return b;
5568
}
5669

SECURITY.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
2+
3+
## Security
4+
5+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6+
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14+
15+
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16+
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18+
19+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20+
21+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
* Full paths of source file(s) related to the manifestation of the issue
23+
* The location of the affected source code (tag/branch/commit or direct URL)
24+
* Any special configuration required to reproduce the issue
25+
* Step-by-step instructions to reproduce the issue
26+
* Proof-of-concept or exploit code (if possible)
27+
* Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

0 commit comments

Comments
 (0)