-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix to cached object oriented bounds rotation assignment
-fixing bug where the cached object oriented bounds for pickupable and moveable sim objects was not assigning the rotation of the bounds correctly. -the boundingBox child object's `rotation` was being set, where the `localRotation` should have been being set -This should fix all sim objects having more accurate placement in all actions requiring the cached bounding box values (PutObject, InitialRandomSpawn, etc)
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
unity/Assets/UnitTests/TestCachedObjectOrientedBoundsRotation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using System; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
using UnityStandardAssets.Characters.FirstPerson; | ||
|
||
namespace Tests { | ||
public class TestCachedObjectOrientedBoundsRotation : TestBase | ||
{ | ||
|
||
//check to make sure the automatic caching of the object oriented bounds is assigning | ||
//the localRotation of the BoundingBox child object of any given SimObject is set to | ||
//(0,0,0) or Quaternion.identity, correctly | ||
[UnityTest] | ||
public IEnumerator TestCachedBoundsRotation() { | ||
Dictionary<string, object> action = new Dictionary<string, object>(); | ||
|
||
action["action"] = "Initialize"; | ||
action["fieldOfView"] = 90f; | ||
action["snapToGrid"] = true; | ||
yield return step(action); | ||
|
||
GameObject book = GameObject.Find("Book_3d15d052"); | ||
|
||
bool result = false; | ||
GameObject boundingBox = book.transform.Find("BoundingBox").gameObject; | ||
|
||
result = Mathf.Approximately(boundingBox.transform.localRotation.x, 0.0f); | ||
Assert.AreEqual(result, true); | ||
|
||
result = Mathf.Approximately(boundingBox.transform.localRotation.y, 0.0f); | ||
Assert.AreEqual(result, true); | ||
|
||
result = Mathf.Approximately(boundingBox.transform.localRotation.z, 0.0f); | ||
Assert.AreEqual(result, true); | ||
} | ||
} | ||
} | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
unity/Assets/UnitTests/TestCachedObjectOrientedBoundsRotation.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.