Recent Posts

Pages: 1 ... 5 6 [7] 8 9 10
61
Support / Re: Asymmetrical Scaling
« Last post by AGP on July 04, 2018, 03:06:45 am »
On the other hand, this time it may well be a Java bug:
Quote
Why does array[idx++]+=a increase idx once in Java 8 but twice in Java 9 and 10?
https://blog.takipi.com/stack-overflow-answers-the-top-java-questions-we-didnt-know-we-had/
62
Support / Re: Asymmetrical Scaling
« Last post by AGP on July 04, 2018, 02:56:55 am »
This still displaces it, but in a different direction:

Code: [Select]
     public void thicken(final float deltaTime) {
SimpleVector[] vertices = this.getSourceMesh();
SimpleVector[] destination = this.getDestinationMesh();
final SimpleVector c = new SimpleVector(obj.getTransformedCenter());
for (int i = 0; i < vertices.length; i++) {
     SimpleVector v = new SimpleVector(vertices[i]);
     v.x -= c.x;
     v.y -= c.y;
     v.z -= c.z;
     v.x *= (1f+deltaTime);
     v.z *= (1f+deltaTime);
     v.x += c.x;
     v.y += c.y;
     v.z += c.z;
     destination[i] = v;
}
this.updateMesh();
     }
63
Support / Re: Asymmetrical Scaling
« Last post by EgonOlsen on July 03, 2018, 06:25:03 pm »
Maybe because your calculations assume that the center is at the origin? I would try this: Take the vertex, translate it by the negated center, scale it and translate it back by the center.
64
Support / Re: Asymmetrical Scaling
« Last post by AGP on July 03, 2018, 01:50:16 am »
It works both ways, but it's getting displaced as it gets wider. Read that last version of thicken() and you'll see my many attempts to keep the center in the same place.
65
Support / Re: Asymmetrical Scaling
« Last post by EgonOlsen on July 02, 2018, 07:44:16 pm »
Ok...so it works without that vertex manipulation but with it (to make the glower larger), it doesn't in some way. Is that the problem? I somehow lost track here...
66
Support / Re: Asymmetrical Scaling
« Last post by AGP on July 01, 2018, 01:41:03 am »
Because I'm altering its vertices with the VertexController.
67
Support / Re: Asymmetrical Scaling
« Last post by EgonOlsen on June 30, 2018, 04:38:59 pm »
I'm not sure, if I understand...if the glow is a child of the saber...then why doesn't it follow it properly?
68
Support / Re: Asymmetrical Scaling
« Last post by AGP on June 29, 2018, 07:49:09 am »
ClearRotation() doesn't do anything (and it shouldn't, since I interpolate the matrices of the lightsaber and the skeletal structure's hand in the loop). ClearTranslation fixed its initial position, thanks very much.

Now, I'm having a hard time keeping glow in the same place. I've tried every permutation of the following method of which I could think:

Code: [Select]
     public void thicken(final float deltaTime) {
SimpleVector[] vertices = this.getSourceMesh();
SimpleVector[] destination = this.getDestinationMesh();
final SimpleVector c = new SimpleVector(obj.getTransformedCenter());
float minX = Float.MAX_VALUE, minZ = Float.MAX_VALUE, maxX = Float.MIN_VALUE, maxZ = Float.MIN_VALUE;
for (int i = 0; i < vertices.length; i++) {
     SimpleVector v = new SimpleVector(vertices[i]);
     v.x *= (1f+deltaTime);
//      v.x -= deltaTime*.5f;
     v.z *= (1f+deltaTime);
//      v.z -= deltaTime*.5f;
     destination[i] = v;
     if (minX > v.x)
minX = v.x;
     if (maxX < v.x)
maxX = v.x;
     if (minZ > v.z)
minZ = v.z;
     if (maxZ < v.z)
maxZ = v.z;
}
this.updateMesh();
SimpleVector d = new SimpleVector((minX-maxX), 0f, (minZ-maxZ));
obj.translate(d);
// obj.clearTranslation();
// obj.calcCenter();
// Glow.moveTo(obj, c);
// Glow.moveTo(obj, d.calcSub(c));
     }
69
Support / Re: Asymmetrical Scaling
« Last post by EgonOlsen on June 28, 2018, 11:25:45 pm »
What happens if you call clearRotation() and clearTranslation() on the glow object?
70
Support / Re: Asymmetrical Scaling
« Last post by AGP on June 28, 2018, 06:38:11 pm »
The glow object is the child of blade (obj in Glow class).
Pages: 1 ... 5 6 [7] 8 9 10