- Home /
Move an object in world space on the viewport
I have a 3d object, that I am unsure how to move relative to the camera UI, from point 1 to point 2
I tried many things and searched everywhere with no luck. The closest (I think I got) was as below:
void FixedUpdate()
{
Vector2 StartPosition = transform.position;
Vector2 DestinationPosition = Camera.main.ScreenToWorldPoint(canvas_object_transform.transform.position);
transform.position = Vector3.MoveTowards(StartPosition, DestinationPosition, collectedMoveSpeed);
}
}
This is an illustration of what I mean:
2d-move-issue.png
(330.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Move a 3d object from world space in the camera UI 2 Answers
Looking for picture in picture effect using Canvas Elements and Cinemachine follow target 0 Answers
How to make World Space Canvas be on top of Overlay Canvas? 0 Answers
Splitscreen cameras not rendering correctly in build 0 Answers
Canvas Screen Space Issue 1 Answer