Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/more features #507

Merged
merged 9 commits into from Jul 11, 2020
Merged

Feat/more features #507

merged 9 commits into from Jul 11, 2020

Conversation

thestonefox
Copy link
Member

No description provided.

The new InitialValue property allows an Action to have the starting
value set in the Unity Editor at edit time. Once the script is started
then the InitialValue will be used to set the default state of the
Action (but no events will be emitted to denote an action change as
technically the state hasn't changed if it is moving to the initial
state).

This new InitialValue property is only for use in the UnityEditor at
Edit time and cannot be changed at runtime nor can it be set via
script. If an initial value is required via creation of an Action
by script then simply just need to create the Action and call
`Receive(<your-initial-value>)` prior to any event listeners being
hooked up. This will simply call the `Receive` method and will
emit the relevant events, but as no event listeners should have
been registered then this won't make any difference.

An extra method of `ReceiveInitialValue` has also been added that
will allow the `Receive` method to be called with the initial set
value. Again, this is only useful for when creating the Action
via the Unity Inspector as the InitialValue cannot be changed via
script.

The `DefaultValue` help text has also been updated to make it more
clearer what this property is for as it's not the starting value
of the Action, but the value the Action needs to be at to be
considered disabled.
A common calculation is finding a fine grain distance between two
points (either Vector2 or Vector3) where the tolerance is also given
in the same type as opposed to just a simple `float`.

The new Vector2.WithinDistance and Vector3.WithinDistance offer this
via the relevant extensions.

Another common calculation is converting euler degrees to signed
degrees, such as 270' is actually equivalent to -90'. This helps when
doing greater than or less than comparisons as a negative rotation of
-90' is less than a rotation of 0' whereas 270' as a number would be
greater than 0'.

The `Vector3.UnsignedEulerToSignedEuler` will convert the current
Vector3 of euler angles into a Signed Euler (-180' to 180f) using the
new `float.GetSignedDegree` which simply converts a Euler angle into
the -180' to 180' range.

These are then used to provide new Transform extensions for:

* `Transform.SignedEulerAngles`
* `Transform.SignedLocalEulerAngles`

Which simply return the respective Euler or Local Euler angle for the
Transform but in this signed format.
A new Property Modifier type known as a Divergable Property Modifier
has been added that allows a property modifier to know when the target
has become diverged from the source in whatever property it is
tracking.

Only certain types of modifier can actually ever cause a divergence,
such as the RigidbodyVelocity and RigidbodyAngularVelocity because they
can make it so the target is not keeping exactly up to date with the
source and become diverged somewhat.

So now both RigidbodyVelocity and RigidbodyAngularVelocity have become
extensions of the DivergablePropertyModifier and now emit events
when the source/target diverge and converge again.

It is also possible to turn off this divergence tracking and it is
turned off by default as it adds an additional overhead, which should
not be automatically implemented unless the overhead is warranted for
the benefits of using the functionality.
The ObjectFollower.EventData can now be proxied via the new
ObjectFollowerEventProxyEmitter and this data can also now be used
as an input to the PropertyModifier `Modify` method as this makes
it easy to chain Property Modifiers together to have one modifier
use its data to call another Property Modifier.
The coding guidelines state that empty classes should have the
brackets on the same line as such:

`class { }`

and not

```
class
{
}
```

This has now been applied to the relevant offending files.
The new Yield events provide the ability to trigger some action after
a yield instruction has completed such as seconds passed or at end of
frame.

This can be used in conjunction with the Proxy events to first store
the payload in the Proxy then trigger the emit after the yield
instruction has completed.
There is an issue where the MinMaxRange control will reset the value
back to the previous value when it is used within a prefab.

The solution seems to be to record the prefab instance property
modification after the custom FloatRange value has been set through
the Supyrb `SetValue` extension, which doesn't set the value via
the SerializedProperty because that is not supported in Unity on custom
data types.

The issue only seems to present itself when changing the value between
varying negative values:

* -0.5
* -0.2
* -0.5 (reverts to 0)
A couple of new Enum helper methods have been added that make getting
an enum easier by either being able to provide the index of the enum
to return or by getting the enum by string name.

The PointerElementPropertyMutator has been updated to take advantage
of this new method.
Some property types cannot be changed via UnityEvents as they are not
supported in the UnityEvent inspector, such as Enums, Vectors and
Vector3State.

This has been fixed by adding custom setter methods that can be called
via the UnityEvent inspector using primitive types that are supported
to allow this data to still be set.
@thestonefox thestonefox merged commit dcead0d into master Jul 11, 2020
@thestonefox thestonefox deleted the feat/more-features branch July 11, 2020 08:25
@ExtendReality-Bot
Copy link
Member

🎉 This PR is included in version 1.20.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants