In Play Mode
Disable the GrabInteractableFollowAction of an Interactable.
Change the RB.isKinematic field.
Enable the GrabInteractableFollowAction of an Interactable.
IsKinematicWhenInactive to stay the same
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.
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.
PR with all the fixes:
https://github.com/ExtendRealityLtd/VRTK/pull/2054