www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Melssj5 on February 23, 2018, 12:12:15 am

Title: My Object3D just dont want to rotate.
Post by: Melssj5 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?
Title: Re: My Object3D just dont want to rotate.
Post by: AeroShark333 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);
Title: Re: My Object3D just dont want to rotate.
Post by: Melssj5 on February 27, 2018, 03:56:18 pm
The Rotation Pivot is relative to the object?? OMG..... Thanks, I will try it
Title: Re: My Object3D just dont want to rotate.
Post by: Melssj5 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.