So say I have X and Y final position values. Let’s take for example X = 1f and Y = 2f.
Right now I have code in a custom script that has this:
transform.localPosition = Vector3.SmoothDamp(transform.localPosition, new Vector3(finalPos.x, finalPos.y, transform.localPosition.z), velocity, posTime);
This works fine for a 2d camera, but when applied to 3d it moves it only along the X and Y axis in world space.
I understand that we have this:
transform.Translate(startPos,endPos);
And I understand that there’s:
transform.right
And:
transform.up
I feel like all the elements needed are here…but I can’t figure it out right now how to move the 3d object along it’s local X and Y coordinates in world space, in other words it’ll probably take translating what’s there…finalPos.x and finalPos.y into a translated 3dobjfinalPos.x, 3dobjfinalPos.y and 3dobjfinalPosz…
So I guess I’m looking at how to translate a Vector2 x and y 2d movement (final pos I mean) into a Vector3 final pos that’s along the 3d object’s x, y, z axis.
In other words, just simply move the 3d camera right, up, down, left with no moving it forward and back in 3d space.
Any help would be greatly appreciated.