Tweening single axis transformation in local space?

Hello all,

I’m working on a project where I need to actuate some hydraulics. In the past tweening was very convenient, and worked perfectly for my usecase. Now though the project includes some cylinders that are mounted on an angle, so it and the parts that it moves aren’t in the ‘straight up’ world orientation.

Does anyone know how to use tween to move a mesh along its own local y axis? I can only get it to move in world y at the moment.

Any input would be greatly appreciated!

I can’t give you any opinion on tweening.

In your use case, I would model a hydraulic cylinder as two distinct meshes: a cylinder and a piston/rod. And then move one relative to the other.

Assuming your application is confined to the x-y plane, your cylinder is inclined versus the positive x-axis by an angle “alpha” and you want the cylinder to extend by “t” units along its local axis.

You can simulate that by the following (pseudo code):

pistonMesh.position.set( tx, ty, 0 ) // assuming, the pistonMesh.position was at ( 0, 0, 0 )

and tx = t * cos( alpha ), ty = t * sin( alpha )