Another Problem With That Iron Patriot

Started by AGP, July 08, 2014, 11:26:10 PM

Previous topic - Next topic

AGP

getTransformedCenter() is in front and underneath it, instead of in the center. There's no triangle whatsoever outside of the model (I have checked), and even calcCenter() doesn't help with that.

Between you and your soccer team, Germany is in great favor with me today. : -)

EgonOlsen

I noticed that too in my test case. No idea why, it has to have something to do with the model import and/or Bones serialization. I would simple set the center to another, more fitting value after loading the model.

About soccer:  :o

EgonOlsen

Which center are you using? The one of the Object3D returned by getRoot()? At least that's the one that i was using.

AGP

I tried both get(0)'s and getRoot()'s. Now, I'm getting something really strange: I added the following method. Even as the spheres visually approach each other, the distance as printed by System.out.println("Distance: "+player.model.getRoot().getTransformedCenter().distance(computer.model.getRoot().getTransformedCenter())) grows.


     private void fixCenters() {
if (ironMan.getIronVersion() == IronMan.IRON_PATRIOT) {
     SimpleVector newCenter = ironMan.model.getRoot().getTransformedCenter();
     newCenter.x -= 100f;
     newCenter.y -= 250f;//250f
     ironMan.model.getRoot().setCenter(newCenter);
     Object3D center = Primitives.getSphere(30f);
     center.build();
     center.translate(ironMan.model.getRoot().getTransformedCenter());
     ironMan.model.getRoot().addChild(center);
     theWorld.addObject(center);
}

SimpleVector c = superman.model.getRoot().getTransformedCenter();
c.z-= 150f;
superman.model.getRoot().setCenter(c);
Object3D superCenter = Primitives.getSphere(30f);
superCenter.build();
superCenter.translate(superman.model.getRoot().getTransformedCenter());
superman.model.getRoot().addChild(superCenter);
theWorld.addObject(superCenter);
     }

EgonOlsen

#4
Can you provide some sample output of superman.model.getRoot().getTransformedCenter() / superman.model.getRoot().getTranslation()?
After all, center is just a point in object space. It has no relevance for anything inside the engine and all that happens when calling getTransformedCenter() is that this point will be transformed by the current world transformation and the resulting point will be returned.

AGP

#5
I see your point, but the balls are where I want them to be and they are approaching each other. The following screenshot shows Iron Patriot moving towards Superman while the distance printout grows.



Oh, and I assume you meant getTranslation(): Superman center: (-10.0,9.6,10.0) Translation: (-5.0,4.8,80.0)

EgonOlsen

Those differences are very minor. They might as well be introduced by the rotation pivot being slightly off or similar. What happens if you move the models closer together? Do these values still increase?

AGP

The differences are very minor per frame. And yes, Iron Patriot is going right through Superman and just keeps going.

EgonOlsen

No idea how this is supposed to happen. But then again, i've no idea what getRoot() actually returns. I would like to see a complete output of

translation of both entities/transformed center of both entities/distance

for a complete run from the start to the point where the entities actually met (maybe not for every frame...but you get the idea).


AGP

I didn't want to abandon this thread, so I'll post my solution: since I knew that the spheres were approaching each other,I tested for the centers of the spheres instead of the centers of getRoot(). But I do think that it's a bug in Bones that the distances grow while visually they should be shrinking (here's a question whose answer I think that I know: would getRoot()'s object space position change at all ever?).

EgonOlsen

I've no idea what getRoot() actually returns and how it relates to transformations of the objects, so i can't answer that... :(

raft

Quote from: EgonOlsen on July 15, 2014, 09:51:14 PM
I've no idea what getRoot() actually returns and how it relates to transformations of the objects, so i can't answer that... :(
getRoot() returns the root object that all animated objects are added as child. Root object is a dummy object, it isn't added to world. it is created by Object3D.createDummyObj(). it's intented to translate/rotate the whole AnimatedGroup easily.

EgonOlsen

That's what i expected, but i have to idea why it should show this odd distance behaviour then... ???

AGP

On two of my computers, I discovered today, I'm having a problem with the Mark 42 model in which the program crashes. I get a JVM log and all. The exact same program runs fine with either Mark 3 or Iron Patriot. It must be a very specific memory thing that only happens on that model and with certain video drivers...

EgonOlsen