Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - AGP

Pages: 1 [2] 3 4 ... 108
16
Support / Re: Asymmetrical Scaling
« on: June 28, 2018, 10:05:23 am »
The original object, blade (obj in the Glow class) is an ExtendedPrimitive. Glow itself is a copy of blade (new Object3D(obj, false)).

17
Support / Re: Asymmetrical Scaling
« on: June 27, 2018, 07:04:58 pm »
It would've been crazy if they weren't in the same place.

Quote
******Blade Bounds:
0.18368883, 0.22368883
-1.0867921, -0.08679211
0.9159291, 0.95592904
******

******Glow Bounds:
0.18368883, 0.22368883
-1.0867921, -0.08679211
0.9159291, 0.95592904
******

18
Support / Re: Asymmetrical Scaling
« on: June 27, 2018, 04:25:34 am »
Have a look at this. The further ahead I move Luke, the further up the glow goes. I've tried, unsuccessfully, rotating getTransformedCenter() of the blade, but it's still wrong.

https://www.dropbox.com/s/ouy2edwxaaxuyfr/TheFurtherAheadTheFurtherUp.webm?dl=0

20
Support / Re: Asymmetrical Scaling
« on: June 26, 2018, 09:21:29 am »
No, that was my failed attempt to solve the problem. It doesn't work with or without it.

21
Support / Re: Asymmetrical Scaling
« on: June 25, 2018, 08:32:46 pm »
This is what I get:

Quote
Glow before build(): (0.20492004,0.06320784,0.28592888)
Glow after build(): (0.20492004,0.06320784,0.28592888)
Glow after translation: (0.31077987,0.6419327,1.6769919) blade: (0.31077987,0.6419327,1.6769919)

22
Support / Re: Asymmetrical Scaling
« on: June 24, 2018, 09:27:10 pm »
There's nothing. This is how glow is created. I even added the setRotationMatrix() call to see if that would help, but nothing changed.

Code: [Select]
if (deltaGrowth > 1.00f) {
     obj.removeChild(glow);
     theWorld.removeObject(glow);
     glow = new Object3D(obj, false);
     glow.setTexture("Glow");
     glow.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
     glow.build();
     glow.setRotationMatrix(obj.getRotationMatrix());
     moveTo(glow, obj.getTransformedCenter());
     glow.setTransparency(100);
     deltaGrowth = 0.00f;
     obj.addChild(glow);
     theWorld.addObject(glow);
     vController = new VertexController(glow);
}

23
Support / Re: Asymmetrical Scaling
« on: June 22, 2018, 10:11:29 am »
Then why doesn't that snippet place the glow over the glower? Can you think of a possible solution?

Edit: I should mention that the original object was created with ExtendedPrimitives.createCylinder(...).

24
Support / Re: Asymmetrical Scaling
« on: June 21, 2018, 10:06:48 pm »
That's weird. I actually have two different, possibly related, problems. The second one is that the glow object, though both parallel and near the original object, is not in the exact same space as the original object. Yet I initialize it like so:

Code: [Select]
glow = new Object3D(obj, false);

Do you have to call build() on the glow object? Also, does getTransformedCenter() always consider the translations of all parents? Because I can't place the glow over the glower even with:

Code: [Select]
SimpleVector to = obj.getTransformedCenter();
SimpleVector o = glow.getTransformedCenter();
glow.translate(to.x-o.x, to.y-o.y, to.z-o.z);

25
Support / Re: Asymmetrical Scaling
« on: June 21, 2018, 06:04:45 pm »
Obviously, that it's scaling in the wrong axis. But only in my real-world use. The test in which I didn't rotate the object worked fine.

26
Support / Asymmetrical Scaling
« on: June 21, 2018, 06:24:00 am »
I'm trying to create a flickering glow. To that end, I wrote the following thickening method in a vertex controller. The problem happens when the base object, from which the glow object is created, is rotated because the glow appears to be modified in worldspace as opposed to in objectspace. What should I do to calculate the x/z distortion in objectspace?

Code: [Select]
     public void thicken(final float deltaTime) {
SimpleVector[] vertices = this.getSourceMesh();
SimpleVector[] destination = this.getDestinationMesh();
for (int i = 0; i < vertices.length; i++) {
     SimpleVector v = vertices[i];
     v.x *= (1f+deltaTime);
     v.z *= (1f+deltaTime);
     destination[i] = v;
}
this.updateMesh();
     }

27
 Since I've already solved it, there's no problem. But what I did there was a splitter: the MD2 exporter exports all animations as a single stream. My program splits them and saves a serialized copy.

28
Some things use the 0, some don't. This print works. The above parsing had but one problem: it was always restarting the keyframes (I just added a delta at the end of the inner loop).

Code: [Select]
     private void printAnimations() {
System.out.println("****************Animations****************");
Animation animation = model.getAnimationSequence();
animationNames = new String[animation.getSequenceCount()];
for (int i = 0; i < animationNames.length; i++) {
     animationNames[i] = animation.getName(i+1);//i+1
     int[] borders = animation.getSequenceBorders(animation.getSequence(animationNames[i]));
     System.out.println("Animation: "+animationNames[i] +", start: "+borders[0] +" end: "+borders[1]);
}
System.out.println("****************Animations****************\n");
      }

29
OK, but if it's by design that the animation in slot 0, as printed by the following code, is "complete," then my problem is that the last animation sub-sequence isn't being created. But there are no complaints about the amount of frames and my method prints a message after finishing its parsing.

Code: [Select]
     private void print() {
Animation animation = model.getAnimationSequence();
String[] animationNames = new String[animation.getSequenceCount()];
for (int i = 0; i < animationNames.length; i++) {
     animationNames[i] = animation.getName(i);
     System.out.println("Animation: "+animationNames[i] +", start: "+animation.getSequenceBorders(i+1)[0] +" end: "+animation.getSequenceBorders(i+1)[1]);
}
     }

30
This is an animation splitter. The following code, instead of naming the first clip the first animation's name, names the second animation that. The second gets the first one's name, the third the second's, and so forth. The first clip seems to get an automatic name of "complete:"

Code: [Select]
     Mesh[] keyFrames = singleStream.getKeyFrames();
     Animation animations = new Animation(keyFrames.length);
     int numberOfAnimations, totalFramesInMax = 0;
     for (numberOfAnimations = 0; numberOfAnimations < nameFields.length && nameFields[numberOfAnimations].getText().trim().length() > 0; numberOfAnimations++)
totalFramesInMax += Integer.parseInt(numberOfFramesFields[numberOfAnimations].getText().trim());
     double divider = (double)totalFramesInMax/(double)keyFrames.length;
     System.out.println("Total Frames in Max: "+totalFramesInMax +" Divider: "+divider +" Number of KeyFrames: "+keyFrames.length);
     for (int i = 0; i < numberOfAnimations; i++) {
final int animationFrames = Integer.parseInt(numberOfFramesFields[i].getText().trim());
final int totalFrames = keyFrames.length;
animations.createSubSequence(nameFields[i].getText().trim());
for (int kf = 0; kf < animationFrames/divider; kf++)
     animations.addKeyFrame(keyFrames[kf]);
System.out.println("Finished for: "+nameFields[i].getText());
     }
     model.setAnimationSequence(animations);

Is this a jpct bug?

Pages: 1 [2] 3 4 ... 108