www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: msandin on January 09, 2016, 05:24:16 pm

Title: Polyline moving around
Post by: msandin 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?
Title: Re: Polyline moving around
Post by: EgonOlsen on January 11, 2016, 09:35:25 am
I'm not sure...are you applying some initial transformations to the object?
Title: Re: Polyline moving around
Post by: EgonOlsen 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.
Title: Re: Polyline moving around
Post by: msandin 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.
Title: Re: Polyline moving around
Post by: msandin 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.
Title: Re: Polyline moving around
Post by: EgonOlsen on January 12, 2016, 08:48:17 pm
Thanks, I'll look into it.
Title: Re: Polyline moving around
Post by: EgonOlsen on January 12, 2016, 09:10:11 pm
This jar should fix the issue: http://jpct.de/download/beta/jpct_ae.jar (http://jpct.de/download/beta/jpct_ae.jar)
Title: Re: Polyline moving around
Post by: msandin on January 12, 2016, 09:54:08 pm
Thanks, that did it!