Vrtk: IsKinematicWhenInactive getting overriden

Created on 9 Aug 2019  路  4Comments  路  Source: ExtendRealityLtd/VRTK

Environment

  • Source of VRTK (GitHub).
  • Version of VRTK (4.0) (9e7ea2cb0a387f3f8e3f57a431d5c1b12d4baaee).
  • Version of the Unity software (2018.4.3f1).
  • Hardware used (Pimax 5k+ , Index Controllers).
  • SDK used (SteamVR).

Steps to reproduce

In Play Mode
Disable the GrabInteractableFollowAction of an Interactable.
Change the RB.isKinematic field.
Enable the GrabInteractableFollowAction of an Interactable.

Expected behavior

IsKinematicWhenInactive to stay the same

Current behavior

On Enable IsKinematicWhenInactive gets changed to what the rigidbody's isKinematic field is set to.

I have made a PR to address this, I think either adding the If statement, or getting rid of it taking the rigidbody's setting would be the best course of action.

All 4 comments

I actually had a similar problem on my usecase that I fixed by adding this last line on this method (class GrabInteractableFollowAction):

protected override void OnAfterGrabSetupChange()
        {
            ObjectFollower.Targets.RunWhenActiveAndEnabled(() => ObjectFollower.Targets.Clear());
            ObjectFollower.Targets.RunWhenActiveAndEnabled(() => ObjectFollower.Targets.Add(GrabSetup.Facade.ConsumerContainer));
            VelocityApplier.Target = GrabSetup.Facade.ConsumerRigidbody != null ? GrabSetup.Facade.ConsumerRigidbody : null;
            ConfigureFollowTracking();
        }

My problem was that the first line of the next method was being called too early - before GrabSetup was set - and therefore 'IsKinematicWhenInactive' was always being set to false.

protected virtual void ConfigureFollowTracking()
        {
            IsKinematicWhenInactive = GrabSetup != null ? GrabSetup.Facade.ConsumerRigidbody.isKinematic : false;
            switch (FollowTracking)
            {
                 ...

I need to try and understand fully what's going on here

I think it's basically saying:

Whatever your default kinematic state of the rigidbody should be the state the rigidbody is set to when the follow function is not running (i.e. inactive).

but what you're doing is saying

the default kinematic state has changed, but you want the rigidbody kinematic state to not be the default state that the item is in when you no longer are performing the follow operation?

Which is confusing, because you're saying

by default the kinematic state of the rigidbody is x

however, when i start following make it y

and when i stop following don't return it back to its default, instead set it to z

is that right?

I actually had a similar problem on my usecase that I fixed by adding this last line on this method (class GrabInteractableFollowAction):

protected override void OnAfterGrabSetupChange()
        {
            ObjectFollower.Targets.RunWhenActiveAndEnabled(() => ObjectFollower.Targets.Clear());
            ObjectFollower.Targets.RunWhenActiveAndEnabled(() => ObjectFollower.Targets.Add(GrabSetup.Facade.ConsumerContainer));
            VelocityApplier.Target = GrabSetup.Facade.ConsumerRigidbody != null ? GrabSetup.Facade.ConsumerRigidbody : null;
            ConfigureFollowTracking();
        }

My problem was that the first line of the next method was being called too early - before GrabSetup was set - and therefore 'IsKinematicWhenInactive' was always being set to false.

protected virtual void ConfigureFollowTracking()
        {
            IsKinematicWhenInactive = GrabSetup != null ? GrabSetup.Facade.ConsumerRigidbody.isKinematic : false;
            switch (FollowTracking)
            {
                 ...

This is probably a legit thing to do.

Was this page helpful?
0 / 5 - 0 ratings