Aeroluna / NoodleExtensions

This mod lets you see cool things that mappers have put in their maps. Report all issues to Reaxt.
MIT License
158 stars 40 forks source link

SpinMod partially incompatible with NoodleExtensions #10

Open xypherorion opened 4 years ago

xypherorion commented 4 years ago

Hey dudes, awesome mod! Something in the way you're doing one or two of the effects, however, completely breaks SpinMod (SpinSaber/WobbleSaber) and causes the play area to go flying off into the distance during a spin. Hoping we can work together to figure out what's going on there as MANY streamers use SpinMod during their streams, and are unable to use their interactive features while still being able to enjoy the game and provide a fun experience for their viewers.

Its most notable about halfway through ANALYS when the tunnel of blocks appears.

I suspect it has something to do with how you're modifying the hierarchy from the PlayerController, or perhaps completely ignoring the PlayerController's current transform. It may be as simple as placing your movement code on a parent transform of the PlayerController and only manipulating the localPosition and localRotation values of your controller's transform. (Basically wedge another transform between PlayerController and its current root)

Thanks! Hit me up on Discord! XypherOrion#1883

xypherorion commented 4 years ago

Visual Example of what occurs. Its https://clips.twitch.tv/SmilingViscousPeachDBstyle

xypherorion commented 3 years ago

Please implement best practice by not manipulating transform.position and transform.rotation directly on root nodes. Use your own root node as a child and use localPosition and localRotation for maximum compatability. You want to be compatible, don't you?

Reaxt commented 3 years ago

I could not find the mod in question publicly available, nor could I find its source code to give this a proper look. Have you considered trying to make a PR to noodle extensions to fix this? Or is the repo for spin mod available somewhere.

xypherorion commented 3 years ago

Perhaps you've misunderstood my description of the problem, this is a Unity3D GameObject Hierarchy problem on the design end of your mod. The issue occurs when something is allowed to modify a transform's absolute position/rotation. Simply removing the ability to move anything with its absolute coordinates and only using the relative versions of position and rotation setters would fix the problem.

NEVER use transform.position ALWAYS use transform.localPosition NEVER use transform.localPosition ALWAYS use transform.localRotation

To allow for a "global" movement or rotation, simply apply them on your root transform's localPosition and localRotation instead of setting its global position and rotation, because global position will overwrite its local (parent-relative) transform values. I hope this helps in further endeavors with Unity3d based projects and cross compatibility as well.

Thanks for taking my feedback. Keep up the great work.

On Fri, Feb 26, 2021 at 12:57 PM Reaxt notifications@github.com wrote:

I could not find the mod in question publicly available, nor could I find its source code to give this a proper look. Have you considered trying to make a PR to noodle extensions to fix this? Or is the repo for spin mod available somewhere.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Aeroluna/NoodleExtensions/issues/10#issuecomment-786801024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVAYFJ6SQIWVVII7PYCMWDTA7OHJANCNFSM4QBY2SSQ .

xypherorion commented 3 years ago

apologies i mistyped that middle section: NEVER use transform.position ALWAYS use transform.localPosition NEVER use transform.rotation ALWAYS use transform.localRotation

On Fri, Feb 26, 2021 at 6:38 PM Xypher Orion xypher.orion@gmail.com wrote:

Perhaps you've misunderstood my description of the problem, this is a Unity3D GameObject Hierarchy problem on the design end of your mod. The issue occurs when something is allowed to modify a transform's absolute position/rotation. Simply removing the ability to move anything with its absolute coordinates and only using the relative versions of position and rotation setters would fix the problem.

NEVER use transform.position ALWAYS use transform.localPosition NEVER use transform.localPosition ALWAYS use transform.localRotation

To allow for a "global" movement or rotation, simply apply them on your root transform's localPosition and localRotation instead of setting its global position and rotation, because global position will overwrite its local (parent-relative) transform values. I hope this helps in further endeavors with Unity3d based projects and cross compatibility as well.

Thanks for taking my feedback. Keep up the great work.

On Fri, Feb 26, 2021 at 12:57 PM Reaxt notifications@github.com wrote:

I could not find the mod in question publicly available, nor could I find its source code to give this a proper look. Have you considered trying to make a PR to noodle extensions to fix this? Or is the repo for spin mod available somewhere.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Aeroluna/NoodleExtensions/issues/10#issuecomment-786801024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVAYFJ6SQIWVVII7PYCMWDTA7OHJANCNFSM4QBY2SSQ .

Reaxt commented 3 years ago

I may not fully agree with some things here, but I can understand what you mean now.

That being said, I do not have a reliable VR setup, or the latest repo set up properly on my system to make changes, if you would like to make the changes to fix this I do insist you make a PR with said changes. Otherwise, I will try to remember to give this a look next time I am working on the mod. I would appreciate it if you pointed me towards a copy, or better yet, the source code for your mod, so that I can assure that whatever I do to fix compatibility, does in fact work on both ends.

xypherorion commented 3 years ago

Aye, after reading over it I think I was rather unclear, but enough of the idea came across, thanks for bearing with me. I've taken a look at noodle, and the vast amount of Harmony patches and lack of sufficient knowledge of how the whole system works would make patching from me...likely undesirable, as I am not confident in my understanding of how the mod /specifically/ works. Is there a specific patch that might correlate with a global move function you can think of off the top of your head? I'm not opposed to patching, but without sufficient knowledge of WHERE to patch i'm trying to find a needle in the dark.

I will take a look at the repo myself soon, but hopefully this helps also. I may be able to provide you with a more complete example, but this is essentially the gist of it:

The following would be added to a MonoBehaviour intended to control a separate transform (spinObj) by reparenting objects in the hierarchy such that only local rotations and movements are necessary, preserving hierarchical transforms so that they are additive instead of destructive.

GameObject spinObj, targetGameObject; //spinObj is the tracked object to be moved, targetGameObject is the transform which is meant to be treated as the parent of the spinObj public void CreateTransformController() { //Create Tweening Object spinObj = new GameObject($"Transform Controller", new Type[] { }); if(targetGameObject == null) targetGameObject = gameObject; //Target Self

        if (targetGameObject != null) {

//Wedge that sucker into the hierarchy //Reorganize the hierarchy with us below the target object in order to affect the desired portion of the hierarchy . Any moves/rotations from hereafter should be achieved with localPosition and localRotation Transform parent = spinObj.transform.parent;

            transform.position =

targetGameObject.transform.root.position; transform.rotation = targetGameObject.transform.root.rotation;

            targetGameObject.transform.SetParent(spinObj.transform);

            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;

            transform.SetParent(parent);
        }

        if (targetGameObject == null) //Nothing targeted, go to sleep
            enabled = false
    }

A move would then be achieved for example: void FixedUpdate() { //Or however you're tracking time in noodle, DSP time? spinObj.localPosition += Vector3.forward Time.fixedDeltaTime; spinObj.localRotation = Quaternion.FromAngleAxis(30.0f Time.fixedDeltaTime Vector3.right); }

On Fri, Feb 26, 2021 at 11:11 PM Reaxt notifications@github.com wrote:

I may not fully agree with some things here, but I can understand what you mean now.

That being said, I do not have a reliable VR setup, or the latest repo set up properly on my system to make changes, if you would like to make the changes to fix this I do insist you make a PR with said changes. Otherwise, I will try to remember to give this a look next time I am working on the mod. I would appreciate it if you pointed me towards a copy, or better yet, the source code for your mod, so that I can assure that whatever I do to fix compatibility, does in fact work on both ends.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Aeroluna/NoodleExtensions/issues/10#issuecomment-787000628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVAYFNVMQ5MDTHSDGKM5QLTBBWGBANCNFSM4QBY2SSQ .