How to Keep an egg in front of the Camera During Hatch Animations?

I’m working on an egg hatching system, and I’m having trouble with keeping the egg always in front of the camera while also adding tweens for the hatch animations. How would I do so?

I’ve tried a few different methods, and some almost worked, but the egg ends up lagging behind or positioned weirdly.

Any help is highly Appreciated. Thank you!!!

ViewportFrame | Documentation - Roblox Creator Hub (evil method)
Bind function regarding position update to event “PreRender” of RunService | Documentation - Roblox Creator Hub

I’m not using viewport frames. I made a gridding function that positions them based on how many eggs there are.

The only way you’d be able to tween while relative to the camera would be using welds. I don’t think tweens will work very well.

W bro you are the real one for that :fire:
Makea function that moves egg regarding player’s camera to front
SO like

local camera = workspace.CurrentCamera
local offset = CFrame.new(5,0,0)
local function UpdateCamera():()
egg.CFrame=camera.CFrame*offset
end
RunService.PreRender:Connect(UpdateCamera)
UpdateCamera()
1 Like

What?
NO!
That a waste of perfomance :rage:
Make a raw math.lerp acording to delta of frame calculation like a real sigma instead

Ok? but i’m sure roblox is already sigma enough to implement that in tweenservice.

jokes aside…
Why the hell do you need a tween service when you work on a frame by frame operation?
CONSTRUCTING ENTIRE CLASS (INSTANCE) for that is insane bro :speaking_head::fire:

1 Like

Because sometimes it’s more convenient?

1 Like

Now that i think of it, tweenservice could easily be combined with bindtorenderstepped to achieve OP’s goal.

1 Like

???
You dont understood the topic and already suggest this “Production based” bloatware bruh.
You update cframe each frame why do you need a crappy TweenService when you have such insane POWER!?
You understemate glorious RunService :crown::crown::crown:

1 Like

if im always changing the eggs cframe how will I add the animation tho :C

You can layer the tween on top of the camera transformation. You need to adjust the camera priority in BindToRenderStepped.

1 Like

make it relative to a Egg’s model then.
I don’t know how you want animation to be implemented tho
You can use Motor6D | Documentation - Roblox Creator Hub for that

1 Like

A tween js cuz like easing styles :scream:

1 Like

I believe this worked. Ill do a little more testing, if all goes right ill give u solution thingy