Fix bounding box size setter
This commit is contained in:
@@ -71,9 +71,6 @@ namespace FlaxEngine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the size.
|
/// Gets or sets the size.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The size.
|
|
||||||
/// </value>
|
|
||||||
[NoSerialize]
|
[NoSerialize]
|
||||||
public Vector3 Size
|
public Vector3 Size
|
||||||
{
|
{
|
||||||
@@ -81,17 +78,15 @@ namespace FlaxEngine
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
var center = Center;
|
var center = Center;
|
||||||
Minimum = center - value;
|
var sizeHalf = value * 0.5f;
|
||||||
Maximum = center + value;
|
Minimum = center - sizeHalf;
|
||||||
|
Maximum = center + sizeHalf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the center point location.
|
/// Gets or sets the center point location.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
|
||||||
/// The center.
|
|
||||||
/// </value>
|
|
||||||
[NoSerialize]
|
[NoSerialize]
|
||||||
public Vector3 Center
|
public Vector3 Center
|
||||||
{
|
{
|
||||||
@@ -156,10 +151,7 @@ namespace FlaxEngine
|
|||||||
/// Determines if there is an intersection between the current object and a <see cref="Ray" />.
|
/// Determines if there is an intersection between the current object and a <see cref="Ray" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ray">The ray to test.</param>
|
/// <param name="ray">The ray to test.</param>
|
||||||
/// <param name="distance">
|
/// <param name="distance">When the method completes, contains the distance of the intersection, or 0 if there was no intersection.</param>
|
||||||
/// When the method completes, contains the distance of the intersection,
|
|
||||||
/// or 0 if there was no intersection.
|
|
||||||
/// </param>
|
|
||||||
/// <returns>Whether the two objects intersected.</returns>
|
/// <returns>Whether the two objects intersected.</returns>
|
||||||
public bool Intersects(ref Ray ray, out float distance)
|
public bool Intersects(ref Ray ray, out float distance)
|
||||||
{
|
{
|
||||||
@@ -170,10 +162,7 @@ namespace FlaxEngine
|
|||||||
/// Determines if there is an intersection between the current object and a <see cref="Ray" />.
|
/// Determines if there is an intersection between the current object and a <see cref="Ray" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ray">The ray to test.</param>
|
/// <param name="ray">The ray to test.</param>
|
||||||
/// <param name="point">
|
/// <param name="point">When the method completes, contains the point of intersection, or <see cref="Vector3.Zero" /> if there was no intersection.</param>
|
||||||
/// When the method completes, contains the point of intersection,
|
|
||||||
/// or <see cref="Vector3.Zero" /> if there was no intersection.
|
|
||||||
/// </param>
|
|
||||||
/// <returns>Whether the two objects intersected.</returns>
|
/// <returns>Whether the two objects intersected.</returns>
|
||||||
public bool Intersects(ref Ray ray, out Vector3 point)
|
public bool Intersects(ref Ray ray, out Vector3 point)
|
||||||
{
|
{
|
||||||
@@ -516,10 +505,7 @@ namespace FlaxEngine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="left">The first value to compare.</param>
|
/// <param name="left">The first value to compare.</param>
|
||||||
/// <param name="right">The second value to compare.</param>
|
/// <param name="right">The second value to compare.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if <paramref name="left" /> has the same value as <paramref name="right" />; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if <paramref name="left" /> has the same value as <paramref name="right" />; otherwise,
|
|
||||||
/// <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator ==(BoundingBox left, BoundingBox right)
|
public static bool operator ==(BoundingBox left, BoundingBox right)
|
||||||
{
|
{
|
||||||
@@ -531,10 +517,7 @@ namespace FlaxEngine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="left">The first value to compare.</param>
|
/// <param name="left">The first value to compare.</param>
|
||||||
/// <param name="right">The second value to compare.</param>
|
/// <param name="right">The second value to compare.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if <paramref name="left" /> has a different value than <paramref name="right" />; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if <paramref name="left" /> has a different value than <paramref name="right" />; otherwise,
|
|
||||||
/// <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static bool operator !=(BoundingBox left, BoundingBox right)
|
public static bool operator !=(BoundingBox left, BoundingBox right)
|
||||||
{
|
{
|
||||||
@@ -544,9 +527,7 @@ namespace FlaxEngine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="System.String" /> that represents this instance.
|
/// Returns a <see cref="System.String" /> that represents this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
|
||||||
/// A <see cref="System.String" /> that represents this instance.
|
|
||||||
/// </returns>
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format(CultureInfo.CurrentCulture,
|
return string.Format(CultureInfo.CurrentCulture,
|
||||||
@@ -577,9 +558,7 @@ namespace FlaxEngine
|
|||||||
/// Returns a <see cref="System.String" /> that represents this instance.
|
/// Returns a <see cref="System.String" /> that represents this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formatProvider">The format provider.</param>
|
/// <param name="formatProvider">The format provider.</param>
|
||||||
/// <returns>
|
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
|
||||||
/// A <see cref="System.String" /> that represents this instance.
|
|
||||||
/// </returns>
|
|
||||||
public string ToString(IFormatProvider formatProvider)
|
public string ToString(IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
return string.Format(formatProvider,
|
return string.Format(formatProvider,
|
||||||
@@ -593,9 +572,7 @@ namespace FlaxEngine
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="format">The format.</param>
|
/// <param name="format">The format.</param>
|
||||||
/// <param name="formatProvider">The format provider.</param>
|
/// <param name="formatProvider">The format provider.</param>
|
||||||
/// <returns>
|
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
|
||||||
/// A <see cref="System.String" /> that represents this instance.
|
|
||||||
/// </returns>
|
|
||||||
public string ToString(string format, IFormatProvider formatProvider)
|
public string ToString(string format, IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
if (format == null)
|
if (format == null)
|
||||||
@@ -610,9 +587,7 @@ namespace FlaxEngine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a hash code for this instance.
|
/// Returns a hash code for this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
|
||||||
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
|
|
||||||
/// </returns>
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
unchecked
|
unchecked
|
||||||
@@ -625,9 +600,7 @@ namespace FlaxEngine
|
|||||||
/// Determines whether the specified <see cref="Vector4" /> is equal to this instance.
|
/// Determines whether the specified <see cref="Vector4" /> is equal to this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The <see cref="Vector4" /> to compare with this instance.</param>
|
/// <param name="value">The <see cref="Vector4" /> to compare with this instance.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if the specified <see cref="Vector4" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if the specified <see cref="Vector4" /> is equal to this instance; otherwise, <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool Equals(ref BoundingBox value)
|
public bool Equals(ref BoundingBox value)
|
||||||
{
|
{
|
||||||
@@ -638,9 +611,7 @@ namespace FlaxEngine
|
|||||||
/// Determines whether the specified <see cref="Vector4" /> is equal to this instance.
|
/// Determines whether the specified <see cref="Vector4" /> is equal to this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The <see cref="Vector4" /> to compare with this instance.</param>
|
/// <param name="value">The <see cref="Vector4" /> to compare with this instance.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if the specified <see cref="Vector4" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if the specified <see cref="Vector4" /> is equal to this instance; otherwise, <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool Equals(BoundingBox value)
|
public bool Equals(BoundingBox value)
|
||||||
{
|
{
|
||||||
@@ -651,14 +622,11 @@ namespace FlaxEngine
|
|||||||
/// Determines whether the specified <see cref="System.Object" /> is equal to this instance.
|
/// Determines whether the specified <see cref="System.Object" /> is equal to this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The <see cref="System.Object" /> to compare with this instance.</param>
|
/// <param name="value">The <see cref="System.Object" /> to compare with this instance.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
public override bool Equals(object value)
|
public override bool Equals(object value)
|
||||||
{
|
{
|
||||||
if (!(value is BoundingBox))
|
if (!(value is BoundingBox))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var strongValue = (BoundingBox)value;
|
var strongValue = (BoundingBox)value;
|
||||||
return Equals(ref strongValue);
|
return Equals(ref strongValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,9 @@ public:
|
|||||||
{
|
{
|
||||||
Vector3 center;
|
Vector3 center;
|
||||||
GetCenter(center);
|
GetCenter(center);
|
||||||
Minimum = center - value;
|
const Vector3 sizeHalf = value * 0.5f;
|
||||||
Maximum = center + value;
|
Minimum = center - sizeHalf;
|
||||||
|
Maximum = center + sizeHalf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user