Author Topic: difficulty targeting a 3D object with release V1.30  (Read 17230 times)

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
difficulty targeting a 3D object with release V1.30
« on: December 29, 2015, 08:52:00 pm »
my menus in 3D does not work with the v1.30 release:
the problem is that if you click on a 3D object, the 3D object is not selected. Sometimes it works after 3 clicks ...

I only use these 2 functions:
SimpleVector dir = Interact2D.reproject2D3DWS (cam, fb, Clickx, clicky) .normalize ();
float res=Cube.calcMinDistance(cam.getPosition (), dir);

In v1.28+v1.29 works fine: It's always return res=25 when i click on the 3D object.
in V1.30: it's return res=9.99999995904E11 when i click on the 3D object ?!?

Have you got any ideas?
Cordialy

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #1 on: December 29, 2015, 09:41:14 pm »
Only a feeling...are you doing these calculations in the touch event method/thread? If so, don't do this but do it in the render thread instead. jPCT-AE isn't thread safe. If you are doing it in the render thread, I need a test case. I don't have this problem nor do I remember any changes in that part.

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
Re: difficulty targeting a 3D object with release V1.30
« Reply #2 on: December 29, 2015, 11:26:59 pm »
these 2 functions are used in the render thread :
SimpleVector dir = Interact2D.reproject2D3DWS (cam, fb, Clickx, clicky) .normalize ();
float res=Cube.calcMinDistance(cam.getPosition (), dir);

and ClickX and ClickY are calculated in the touch event method/thread.

I checked the first function (Interact2D.reproject2D3DWS (cam, fb, Clickx, clicky) .normalize () by projecting a 3D ball from the click : it's seems correct ...(see picture). http://www.jpct.net/forum2/Smileys/default/huh.gif

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #3 on: December 30, 2015, 10:46:28 am »
Have you tried the calcMinDistance() version that takes an additional max. distance parameter? Set it to something large like 1000 or 10000 and see, if that changes something. If it doesn't, I need a test case. I can't reproduce this problem, everything works fine in my tests.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #4 on: December 30, 2015, 01:06:21 pm »
I checked the code changes regarding ray-polygon stuff and all that happended was that I converted a lot of floats to doubles (but I can't spot any error in those) and that I made a constant smaller (but I don't see, why this should have a negative impact). If you can provide me with a test case, I can revert these changes and see if that chanegs something. But as said: In my tests, all is well.... ???

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
Re: difficulty targeting a 3D object with release V1.30
« Reply #5 on: December 30, 2015, 09:03:15 pm »
I  tested the menu 3D on this devices:
Genymotion with android 4.4.2 and JPCT v1.30 : It's works
Samsung S4 Mini with android 4.4.2 and JPCT v1.29: it's works
Samsung S4 Mini with android 4.4.2 and  JPCT v1.30: it's does not works  ???
Samsung J5 with android 5.1.1 and Jpct v1.30 : it's works


I tried  calcMinDistance ( cam.getPosition (), dir , 1000)" and i see no change.


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #6 on: December 31, 2015, 10:32:26 am »
I really don't see what should cause this. It's the same calculation. As long as the VM behaves the same (which it has to), the outcome should be deterministic regardless of the device. It's just math, there's no gpu/driver specific code involved.
Just to be sure: Have you double checked that your input parameters are correct in all cases?
« Last Edit: December 31, 2015, 10:36:01 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #7 on: December 31, 2015, 12:37:31 pm »
Here's a version that reverts the change in the constant: http://jpct.de/download/tmp/jpct_ae.jar

Please let me know, if that changes anything or not.

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
Re: difficulty targeting a 3D object with release V1.30
« Reply #8 on: December 31, 2015, 02:55:20 pm »

with this version 1.31, i see no change  ???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #9 on: December 31, 2015, 03:15:02 pm »
I really don't know what it's supposed to be then. Can you please try this: Loop over some x,y coordinates (instead of the ones taken from the touch events), run your code on each set and see what happens...does it fail at all? If it does, does it fail for all values? If not, does it always fail for the same values or is it 'random'?
« Last Edit: December 31, 2015, 03:25:20 pm by EgonOlsen »

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
Re: difficulty targeting a 3D object with release V1.30
« Reply #10 on: December 31, 2015, 06:17:38 pm »
data for all test:   
ClickX=   864   
ClickY=   164   
Camera.getPosition=(0.0,-30.0,150.0)   
   
      
results:

Interact2D.reproject2D3DWS (cam, fb, Clickx, clicky) .normalize () always return  (-0.4566984,-0.121633224,-0.8812672) in V1.29 & V1.30

      
                 V1.29                                V1.30
N° Click     CalcminDistance=               CalcminDistance=
1               "2.3096227645874023"   "2.3096227645874023" =>  it's always Ok in V1.30 when first click !!
2               "2.3096227645874023"   "9.99999995904E11" :o => Second click and the next click are bad in V1.30
3               "2.3096227645874023"   "9.99999995904E11" :o
4               "2.3096227645874023"   "9.99999995904E11" :o
5               "2.3096227645874023"   "9.99999995904E11" :o
6               "2.3096227645874023"   "9.99999995904E11" :o
7               "2.3096227645874023"   "9.99999995904E11" :o
8               "2.3096227645874023"   "9.99999995904E11" :o
« Last Edit: December 31, 2015, 06:20:51 pm by jaco robier »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #11 on: January 01, 2016, 11:25:17 am »
Now it's getting really strange...and this happens on Samsung S4 Mini only or on all devices?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #12 on: January 01, 2016, 11:50:28 am »
Ok...I've triple checked all my changes between the versions and this behaviour makes no f!"/("/()'##ing sense. Can you please try this jar (it reverts the float->double changes): http://jpct.de/download/tmp/jpct_ae.jar. If that doesn't help, than I don't know what will. However, even if it does, it's not a proper solution. In addition, please try this one as well: http://jpct.de/download/tmp/2/jpct_ae.jar

Offline jaco robier

  • byte
  • *
  • Posts: 14
    • View Profile
Re: difficulty targeting a 3D object with release V1.30
« Reply #13 on: January 01, 2016, 04:21:26 pm »

I see this problem only on my Samsung S4 Mini. And I see no problem in v1.30 on my second SmartPhone Samsung J5.


I tried your new  Jar V1.31  from http://jpct.de/download/tmp/jpct_ae.jar
and .... it's work fine on all my device  ;D


I tested too your jar from http://jpct.de/download/tmp/2/jpct_ae.jar and it does not work.

thank you for your help!

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: difficulty targeting a 3D object with release V1.30
« Reply #14 on: January 01, 2016, 04:26:17 pm »
So, it's obviously an issue with the double/float stuff. I really think that this is actually a bug in the VM or, more likely, in the JIT compiler (because it works fine in the first iteration). I'm not sure how to counter this...the version that you are using now reverts back to float, which actually isn't what I want to do. I might make this optional, so that you can revert to the old behaviour (that works for you) by setting a Config switch.
I'll report back later...