#Moving parent of InteractiveToy makes it unusable

1 messages · Page 1 of 1 (latest)

haughty sigil
#

I created a PrimitiveObjectToy to be used as a networked parent object, with an InteractiveToy attached to it as a child.
If i interact with the toy where it is spawned, the Interaction events in PlayerEvents get called as expected.
If i move the parent object (far away), and thus the toy moves with it, on my client i can still interact with the toy and get the searching circle as expected, but none of the Interaction events get called.

real haven
#

did you spawn the parent?

haughty sigil
#

Yes

real haven
#

are you sure the children are parented

haughty sigil
#

Yes, they move successfully

#

Again, my client can interact with them and with a InteractionDuration >0, i can also see the Search circle progress

real haven
#

could you show your code?

#

the interactable should be moving if parented correctly

haughty sigil
#

I will send the code in a bit for context for other people, but it would be very easy to show the problem in a vc screenshare

real haven
#

moment

haughty sigil
#

"Container" primitive

PrimitiveObjectToy prim = PrimitiveObjectToy.Create(
    Vector3.zero,
    Quaternion.identity,
    Vector3.one,
    null,
    true
    );
prim.Type = PrimitiveType.Cube;
prim.Color = new Color(0f, 0f, 1f, 0.3f); // a bit visible for debugging
prim.Flags = PrimitiveFlags.Visible;
prim.Spawn();
prim.GameObject.name = "ModMenuContainer";
MenuContainer = prim;

Child InteractiveToy:

InteractableToy itoy = InteractableToy.Create(
    buttonPosition, // Slight offset from zero
    MenuContainer.Rotation,
    new(0.6f, 0.3f, 0.1f),
    MenuContainer.Transform, // Parent to primitive
    true);
itoy.InteractionDuration = 0.8f;
itoy.Spawn();

// Primitive to visualize interactiveToy
PrimitiveObjectToy buttonPrim = PrimitiveObjectToy.Create(
    Vector3.zero,
    Quaternion.identity,
    Vector3.one,
    itoy.Transform,
    true
);
buttonPrim.Type = PrimitiveType.Cube;
buttonPrim.Color = new Color(0f, 1f, 0f, 1f);
buttonPrim.Flags = PrimitiveFlags.Visible;
//buttonPrim.MovementSmoothing = 0;
buttonPrim.Spawn();
buttonPrim.GameObject.name = $"InteractBoxVisualizer_{i}";
buttonPrim.Transform.localScale = Vector3.one;
#

Nevermind.
The object was moved via fake sync.
So in reality the interactive toy was at 0,0,0

#

Fixed by

[HarmonyPatch(typeof(InvisibleInteractableToy.InteractableToySearchCompletor), nameof(InvisibleInteractableToy.InteractableToySearchCompletor.ValidateDistance))/*, HarmonyDebug*/]
public static class InteractableToyDistancePatch
{
    public static bool Prefix(ref bool __result)
    {
        __result = true;
        return false;
    }
}
vale frost
#

they should make ValidateDistance check a server side only value of the InteractiveToy

#

I'll suggest it rn

#

nvm

#

you could cast the IVerificationRule to StandardDistanceVerification then modify its max distance

#

bit crude but idc, Exiled can add it for all I care

autumn lodge
#

Y'know that changes on SDV does not sync to client?

#

Server might able to recognize but in client it will deny your interaction

#

But idk maybe it could work idk

vale frost
#

Well the whole point was that the toy was moved with a faked sync var