Multiple Moving Platforms with Tween Script

I am back at it again with another question regarding the movement of objects using a tween script. So I was told that I would have to make an new script for each moving platform I wanted to create in my game, however, when I use the code (line for line) from the tween-position script it’s not working. Same thing goes for my rotation script, however, for this I’d only need to make 3 of them each for a different axis (if we don’t account for making different speeds.)

Project Link (Factory is where I’m currently working): PlayCanvas 3D HTML5 Game Engine

Again thank you for helping in advance.

I don’t get what you are asking. Can you please explain more.

If you can use the same code, you can use the same script. For example, if you want to move every platfrom to the left and back to the right, you can use the same script on every platform.

I guess you mean the script below? It looks like you have changed the name of the script. Parse the script after changing the name. Right now the attributes are also not visible in the editor. The same goes for the rotation script that doesn’t work.


1 Like

Alright thank you, however, the axis of which I want to rotate the gear on isn’t X, Y, or Z apparently. How would I get it to turn.

There is no other axis as far as I know.

If the pivot of the model is in the middle you don’t need a tween to spin the gear. You could try to use the rule below in the update function of your script. Please find the right axis yourself. You can change rotate direction with positive or negative rotate speed.