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.
Hiya, the way they do it prior to the animation rework, is that they have a billboard gui that has its offset above the pet, it will then sit then with a slight sine wave animation, after that the pet uses a camera space module (that is a free model i believe, if its not i can give it to you, its relatively easy to use) to calculate where on the screen it will move to, that position will chance as more pets are added to the camera space modules data. as its moving the billboard gui’s offset flips to the bottom of the pet. its kinda hard to explain but if you see it inside the studios explorer then it makes more sense, no viewport frames or any gui besides the billboards are used
there are alot of uncopylocked versions of pet sim x that uses the same version as the one shown in the video, if you want to see how it works exactly, i recommend looking at the scripts, but not using them as you will get moderated
In these videos, you can find a simple idea how to make a hatching system that BIG GAMES (Pet Simulator 99) use for their games. There are a few tips, which you can modify and upgrade by use a skilled programmer/scripter, but if you are new in this category, you will watch these (tutorials) and understand how it works.
I hope, you understand that I mean.