# Tween to an x y z position in 3d

It would be nice to be able to tween a 3D object to a position where you can specify the x y and z positions. As well as move a 3d object to a x y and z position instead of just an x and y position.

For this game that I am working on:

Can you achieve the same result by running 3 positional tweens at the same time - that is tween to X, Y & Z all in the same event over the same duration using the same easing?

I wish there were a 3 positional tween, but for now there is only a 2 positional tween X and Y

and there is no gravitational pull like in 2d.

While youâ€™re waiting for this feature, you could use the 3 individual positional tweens and wrap them up in an action extension. Then youâ€™d have one function to do what youâ€™re after.

You can set position to some variable
You can tween variable
So technically you can tween any position axis

There are positional tweens already available for each individual axis:

So the problem here is not lack of ability
But lack of function?
I misunderstood the problem which is it being one single action?

I tried to tween it in the x and y and the tweened the z in the action

it worked and then I served the game to gdev game site and it worked, the cars decend smoothly down and up the ramps.

But then I went back and changes some paramaters and it stopped working, I am trying to get it to work again.

I tried this but it looks too choppy, going forward then down then repeats until it reaches the bottom floor.

I was thinking of moving it like a projectile off the top of the ramp to the bottom floor.

I think I will try move it with a hitbox???

What changes did you make?

And instead of using the â€śTrigger onceâ€ť with each â€śTween finished playingâ€ť condition, Iâ€™d suggest you remove all the trigger once, and in the actions drop the tween thatâ€™s just finished. Itâ€™s a cleaner and better way to do it:

I removed the trigger once and it kept rotating on the z axis

this is one solution that i havenâ€™t tried yet

I guess the solution was for a 3d object rotating around a point then projecting off a ramp.

got it to work again, just wish i could do this in one action tween to an xyz position instead of having to tween to xy and then to z positions seperately

Did you also include the action to remove the tween from RaceRed? From what you have written, I suspect not. Itâ€™s an important action, otherwise the condition is met every game frame and the actions are performed every game frame.

Write your own action extension, and then you can call it up in one action.

I am going to look into that. I will let you know what I come up with. I will have to do so reading.

https://wiki.gdevelop.io/gdevelop5/extensions/create/

would i need to create a function or behavior?

1 Like

Behaviour, I would have thought, as itâ€™s working on the RaceRed object.