Distancing geometry from its axis

Hi. I’m trying to distance a geometry from its axis, but i’m not getting :(. When i distance its model bound from center( its axis ), just the model bound departs, the visual geometry stands. I already tried with updateGeometricState() and updateModelBound(). I’m doing so :



[java]

@Override

public void simpleUpdate(float tpf) {

rootNode.detachChildNamed(“selection”);

BoundingBox box = (BoundingBox) wheel.getModelBound();

select(box);

box.getCenter().addLocal(0, .01f, 0);

}

[/java]



Screenshot :



Move the wheel and update its bounds.

@Alpedar: Thanks for reply, but isn’t this what i wanna do. I don’t wanna change the wheel’s local translation, i just wanna distance it from its axis.



edit: When i said “-i wanna distance it from its axis”, i wanted to say - to distance the “visual wheel geometry” from its local translation(axis).

Have second wheel used only for visuals and invisible real wheel.

Hmm! I’ll be more clear so you can to understand my problem. I’ll demonstrate in blender :



Here’s a geometry that the distance to its axis is [0.0, 0.0, 0.0]. And its translation is [0.0, 0.0, 0.0] :







Here’s a geometry that the distance to its axis is [0.0, 0.5, 0.0] ( [0.0, 0.0, 0.5] in blender). Perceive that its translation still is 0,0,0 :







Then is this what i wanna do at first post, but in jme of course.

You could create a node at the same position, attach the wheel to the node, move the wheel to desired position, then rotate the node.

@nehon: Wasn’t well it what i wanted to do. I wanna create a “setOrigin” method, like in blender (origin_set). Then i’m trying so :



[java] public void setOrigin(Geometry geo, Vector3f origin) {

BoundingBox box = (BoundingBox) geo.getModelBound();

box.setCenter(origin);

}[/java]



But doesn’t works as should, because the localTranslation doesn’t change. The Local Translation should be equal to the geo.getModelBound().getCenter().

The image below will explain better. As you can see, the wheel’s local translation is Vector.ZERO, but it’s separated from its center( axis ). Then is basically it what i wanna do with the “setOrigin” method, to separate the wheel from its axis without touch in your “local translation”.







Thanks for patience!

The bounding volume is only used for culling, if you want to change the position of an object, use setLocalTranslation(). You can determine the center of an object’s geometry relative to the model’s origin by using the model bound’s center.

Did you say i have to use setLocalTranslation() if i wanna change the position of an object ok?Then why the wheel is separated of its center and its local translation still is [0.0, 0.0, 0.0] (its parent also)? I know this was made in blender, but can i do it in jme? It’s possible? Any example?

The geometry of the wheel itself might be shifted relative to the model’s origin, in that case, the local translation of the object will be zero but its actual location will not be zero

1 Like
Momoko_Fan said:
The geometry of the wheel itself might be shifted relative to the model's origin...


Ok, then i try to shift the wheel by using wheel.getModelBound().setCenter(newCenter); so its local translation don't change, but the wheel doesn't move, only its model bound. It don't work.
Ok, then i try to shift the wheel by using wheel.getModelBound().setCenter(newCenter);

The bounding volume is only used for culling, if you want to change the position of an object, use setLocalTranslation().