Putting objects in front of camera

Hey!

Games like bubble gum simulator and pet simulator when you open eggs are putting a 3D object in front of the camera like it’s a 2D object.

Are they using clonetroopers module 3D or is their a better way to do this now?

2 Likes

They are probably using Module3D, but the good news is that there is a new feature in beta that will be able to render 3D objects in the 2D space (that many people are using for the games even though it’s not released in live servers yet lol)

3 Likes

I wrote that code for Bubble Gum Simulator. Set the CFrame of the part relative to the Camera’s CFrame and update it on render step. Example:

part.CFrame = camera.CFrame * CFrame.new(0, 0, -8)
13 Likes

Yup, that’s how I’ve done it too. Made a little 3D arrow to point you in the right direction.


If it needs to be stated: You should do this with BindToRenderStep and make sure it runs after the camera updates:

game:GetService("RunService"):BindToRenderStep("...", Enum.RenderPriority.Camera.Value + 1, function()
   part.CFrame = ...
end)

The +1 is there just to ensure it definitely gets executed after anything at the camera level (which technically is quite arbitrary and depends on how your camera system is implemented–just make sure it runs after the camera updates).

13 Likes