How to make a 3D egg hatching, change position / How to make it seem realistic

Hey developers! I am making a 3D egg, and I am having some issues making the egg more realisitic. I don’t know how to explain it, but it seems like it’s moving more to the tip of the egg, instead of the base of the egg, if that makes sense? I want it like, the animation of a exclusive egg from pet simulator X, where it looks normal, where the base of the egg, doesn’t move as much as the ‘tip of the egg’.

This is my curent code:

	connection1 = game:GetService("RunService").Heartbeat:Connect(function(dt)
		t += dt
		local v = math.exp(0.2*t) 
		local angle = math.sin(x*t*v)
		Egg:PivotTo(plr:FindFirstChild("HumanoidRootPart").CFrame *, 0, 5) * CFrame.Angles(0,0,angle ))
		if t >= 6 then

And this is my current Video of the egg’s weird movement.

Any help is appreciated!

Changing the WorldPivot property of the egg to be the bottom should make it work (use the pivot editor under Model tab I believe).

If you want to rely solely on math you could find the bottom of the egg (egg.CF *, -part.Size.Y / 2, 0), then applying the rotation, add another offset to the rotated bottom CFrame, this offset should be rotatedCFrame.UpVector * part.Size / 2

For an egg shape:

local part = script.Parent

local bottom = part.CFrame *, -part.Size.Y / 2, 0) -- bottom surface of the egg (or in my case the part)

	local angle = math.sin(tick() * 4) -- this would be your formula which speeds up over time
	local rotation = CFrame.Angles(0, 0, angle / 4)
	local offset = rotation + rotation.UpVector * part.Size / 2
	part.CFrame = bottom * rotation * offset

Note: it may be offset from where your egg is supposed to be positioned, in that case you’d just subtract a vertical-directional (Vector3(0, number, 0)) vector from bottom to move where the bottom of the egg should be positioned in world space.


Thank you so much. I didn’t know the pivot tool also worked as an option.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.