Author Topic: My Object3D just dont want to rotate.  (Read 2378 times)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
My Object3D just dont want to rotate.
« on: February 23, 2018, 12:12:15 am »
Hi guys, I am building a car instrument cluster with jpct, I am trying to move the rpm and speedometer needles but they just dont rotate.

I have a small object where the needle pivot  should be. I am doing this:

speed_neddle.setRotationPivot(speed_pivot.getROtationPivot());
speed_neddle.rotateZ(any value);

but it just wont move.


Any ideas?
Nada por ahora

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: My Object3D just dont want to rotate.
« Reply #1 on: February 26, 2018, 12:03:27 am »
I don't think you want to use the rotation pivot like this:
speed_neddle.setRotationPivot(speed_pivot.getROtationPivot());

A rotation pivot is a point relative to the Object3D where you want to pivot around.
So I'd think you'll need to SimpleVector that's the difference between the two Object3D's.
SimpleVector diff = speed_pivot.getTransformedCenter();
diff.sub(speed_neddle.getTransformedCenter());
speed_neddle.setRotationPivot(diff);

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: My Object3D just dont want to rotate.
« Reply #2 on: February 27, 2018, 03:56:18 pm »
The Rotation Pivot is relative to the object?? OMG..... Thanks, I will try it
Nada por ahora

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Re: My Object3D just dont want to rotate.
« Reply #3 on: March 15, 2018, 02:26:26 pm »
SOLVED: The problem was neither the pivot center nor the maths. The problem was that I was referencing and moving an Object3D and adding another one to the world. I fixed this and everything is working.
Nada por ahora