Skip to content

Commit ade73f2

Browse files
committed
Rope updates
1 parent 57a022d commit ade73f2

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

src/gameobjects/rope/Rope.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -468,18 +468,20 @@ var Rope = new Class({
468468
this.resizeArrays(total);
469469
}
470470

471-
var index = 0;
472-
var amount = 0;
471+
var u0 = this.frame.u0;
472+
var v0 = this.frame.v0;
473+
var u1 = this.frame.u1;
474+
var v1 = this.frame.v1;
475+
var part = (u1 - u0) / (total - 1);
473476

474477
for (var i = 0; i < total; i++)
475478
{
476-
index = i * 4;
477-
amount = i / (total - 1);
478-
479-
currentUVs[index] = amount;
480-
currentUVs[index + 1] = 0;
481-
currentUVs[index + 2] = amount;
482-
currentUVs[index + 3] = 1;
479+
var index = i * 4;
480+
481+
currentUVs[index] = u0 + (i * part);
482+
currentUVs[index + 1] = v0;
483+
currentUVs[index + 2] = u0 + (i * part);
484+
currentUVs[index + 3] = v1;
483485
}
484486

485487
this.points = points;
@@ -581,12 +583,12 @@ var Rope = new Class({
581583
perp.x = nextPoint.y - lastPoint.y;
582584
perp.y = -(nextPoint.x - lastPoint.x);
583585

584-
var ratio = (1 - (i / (total - 1))) * 10;
586+
// var ratio = (1 - (i / (total - 1))) * 10;
585587

586-
if (ratio > 1)
587-
{
588-
ratio = 1;
589-
}
588+
// if (ratio > 1)
589+
// {
590+
// ratio = 1;
591+
// }
590592

591593
var perpLength = perp.length();
592594
var num = this.frame.halfHeight;

0 commit comments

Comments
 (0)