Xlinka / NeosPlus

NeosVR Plugin Extra Logix nodes and features
https://discord.gg/9QAaMtXwke
Other
29 stars 19 forks source link

Add ExtractIDs LogiX node #144

Closed Nytra closed 11 months ago

Nytra commented 11 months ago

Takes a RefID and outputs a ulong for Position and a byte for User

This is possible to do in vanilla Neos with a handful of logix nodes but this does it in just one.

Arti said this would be useful.

20230722131841_1

Xlinka commented 11 months ago
using FrooxEngine.LogiX;

[Category("LogiX/References")]
[NodeName("Extract IDs")]
public class ExtractIDs : LogixNode
{
    public readonly Input<RefID> RefID;
    public readonly Output<ulong> Position;
    public readonly Output<byte> User;

    protected override void OnEvaluate()
    {
        RefID refId = RefID.Evaluate();
        if (refId != null)
        {
            refId.ExtractIDs(out ulong position, out byte user);
            Position.Value = position;
            User.Value = user;
        }
        else
        {
            Position.Value = 0;
            User.Value = 0;
        }
    }
}

this is how i would do this node.

Nytra commented 11 months ago

Updated node to use your code