Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

This is the detailed formula for converting Funscript to Vorze Piston motion commands, derived from Buttplug(https://github.com/buttplugio/buttplug). It can reduce your workload.I have the device and have verified its accuracy. Good luck with your development.

public async Task<IEnumerable<HardwareCommand>> HandleLinearCmd(LinearCmdV4 msg)

{

    var vector = msg.Vectors[0];

    var position = (byte)(vector.Position * 200);

    var distance = Math.Abs(_previousPosition - position);

    var speed = CalculatePistonSpeed(distance, msg.Duration);

    lock (_positionLock)

        _previousPosition = position;

    return new[] { new HardwareWriteCmd(Endpoint.Tx, new[] { 

        (byte)_deviceType, 

        position, 

        speed 

    }, true) };

}

private static byte CalculatePistonSpeed(double distance, double duration)

{

    if (distance <= 0)

        return 100;

    distance = Math.Min(distance, 200);

    duration = 200 * duration / distance;

    var speed = Math.Pow(duration / 6658, -1.21);

    speed = Math.Clamp(speed, 0, 100);

    return (byte)speed;

}