Skip to content

Commit 50be5ee

Browse files
Fix U8 wrap issue with path
1 parent d54d97a commit 50be5ee

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/classes/Utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ export class Utils
413413

414414
public static packPathShear(pathShear: number): number
415415
{
416-
return Math.round(pathShear / Utils.SHEAR_QUANTA);
416+
const packed = Math.round(pathShear / Utils.SHEAR_QUANTA);
417+
return packed < 0 ? packed + 256 : packed;
417418
}
418419

419420
public static packPathTwist(pathTwist: number): number
@@ -453,17 +454,17 @@ export class Utils
453454

454455
public static unpackPathShear(pathShear: number): number
455456
{
456-
return pathShear * Utils.SHEAR_QUANTA;
457+
return (pathShear > 127 ? pathShear - 256 : pathShear) * Utils.SHEAR_QUANTA;
457458
}
458459

459460
public static unpackPathTwist(pathTwist: number): number
460461
{
461-
return pathTwist * Utils.SCALE_QUANTA;
462+
return (pathTwist > 127 ? pathTwist - 256 : pathTwist) * Utils.SCALE_QUANTA;
462463
}
463464

464465
public static unpackPathTaper(pathTaper: number): number
465466
{
466-
return pathTaper * Utils.TAPER_QUANTA;
467+
return (pathTaper > 127 ? pathTaper - 256 : pathTaper) * Utils.TAPER_QUANTA;
467468
}
468469

469470
public static unpackPathRevolutions(pathRevolutions: number): number

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@caspertech/node-metaverse",
3-
"version": "0.8.13",
3+
"version": "0.8.14",
44
"description": "A node.js interface for Second Life.",
55
"main": "dist/lib/index.js",
66
"types": "dist/lib/index.d.ts",

0 commit comments

Comments
 (0)