Author Topic: Polyline moving around  (Read 670 times)

Offline msandin

  • byte
  • *
  • Posts: 20
    • View Profile
Polyline moving around
« on: January 09, 2016, 05:24:16 pm »
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:

Code: [Select]
        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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Polyline moving around
« Reply #1 on: January 11, 2016, 09:35:25 am »
I'm not sure...are you applying some initial transformations to the object?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Polyline moving around
« Reply #2 on: January 11, 2016, 08:44:45 pm »
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.

Offline msandin

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Polyline moving around
« Reply #3 on: January 12, 2016, 08:07:14 am »
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.

Offline msandin

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Polyline moving around
« Reply #4 on: January 12, 2016, 08:43:08 pm »
I believe that the offending line is this:
Code: [Select]
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Polyline moving around
« Reply #5 on: January 12, 2016, 08:48:17 pm »
Thanks, I'll look into it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Polyline moving around
« Reply #6 on: January 12, 2016, 09:10:11 pm »
This jar should fix the issue: http://jpct.de/download/beta/jpct_ae.jar

Offline msandin

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Polyline moving around
« Reply #7 on: January 12, 2016, 09:54:08 pm »
Thanks, that did it!