Polyline moving around

Started by msandin, January 09, 2016, 05:24:16 PM

Previous topic - Next topic

msandin

Hello,

I've played around around with trying to add polylines for showing vertex normals but have failed because they would not behave correctly on the Y-axis. So I created this tiny example:


        Object3D object = ...;
        world.addObject(object);
        world.addPolyline(new Polyline(new SimpleVector[] {
                object.getTransformedCenter(),
                object.getTransformedCenter().calcAdd(new SimpleVector(1, 1, 1))
        }, RGBColor.RED));


The thing that happens is that as the polyline has the right direction and magnitude but originates a fair bit below the object when I stand close to it and as I back away from it in any direction the entire line moves further down and ultimately disappears through the floor of my level. The line doesn't seem to otherwise transform, it just moves downwards. The object and line are stationary, only the camera is moving, and only on the X- and Z-axes while rotation around the Y-axis. Am I misunderstanding how this is supposed to work?

EgonOlsen

I'm not sure...are you applying some initial transformations to the object?

EgonOlsen

I made myself a test case, but everything works as expected. I can't see any problem with Polyline. Are you using the setParent()-method or Polyline? Because if so, keep in mind that in that case, the Polyline has to be defined in object- and not in world space.

msandin

Well then, thanks for trying! I'll spend some time as soon as possible trying to get a complete example going to isolate the cause and report back when I do.

msandin

I believe that the offending line is this:

Config.viewportOffsetY = -0.15f;

If I set this the property the line won't stay properly anchored in three dimensions but will rather start out too low and move downwards as the distance increases.

EgonOlsen


EgonOlsen


msandin