I wanted to share here what I have been wondering for a long time because I could not find a correct result despite a little research…
When you open an egg in Pet Simulator 99, the pet you hatch first stands next to you for a few seconds and then animatedly approaches your camera. What is the most logical approach for this thing? How can it be done? Can you show an example or can you share a source?
I would guess they are lerping each pet to a pre-defined object-space CFrame in front of the camera. Since the animation stays with the camera when it is moving, I don’t think tween will do what you want so you’ll need to write a lerp function and run it every frame to achieve the effect.
I suppose they created an Invisibile Frame that cover the whole screen, which contains Gridlayout or ListLayout and smaller frames based on the amount of pets they are collecting. Then get the world position using Camera:ScreenPointToRay() with the smaller frames AbsolutePosition as input. After that, you set the pet model CFrame with UnitRay.Position returned from the Camera:ScreenPointToRay() and rotate the pet with UnitRay.Direction or “Camera.CFrame:ToEulerAnglesYXZ()”
I doubt they are using viewport frames but instead just have each pet created on the client. That way the pets are actually being moved in front of the camera every frame while other clients delete others’ newly hatched pets. You could make UI for every pet hatched like @idkhowtomakeusername said, or calculate the position of each tile by dividing the camera.ViewportSize into partitions.
The way it works is that the pets positions are constantly updated to the players camera through a runservice loop probably. You may want to play around with it but yea.