I would like to use 2D scene to mimic a 3D movement, what should I do with speed/size

Godot Version

4.3 stable

Question

Beginner. I may not think this right. I am trying to use simple foreshortening to mimic a 3D movement, by 1. updating a mob size by time, 2. updating a mob speed by time (acceleration).

Should I update position per frame? or is there some existing object / techniques i can use?

Thank you

Probably just use the physics engine that’s built in. The origin (the (0,0) position) should be set appropriately; that point won’t change, but your size will change relative to that point.

Can you elaborate what you mean by buildin physics engine?

Node2D and a lot of its derived nodes work with Godot’s physics engine. I may have misunderstood; for updating a mobs position, you can simply give it a Node2D base and add things like collision shape, etc., which will all stay relative to the Node2D. Then you can give that node velocity in the 2D plane.

All physics engines are pretty powerful and will handle a lot of per-frame movements and collision detection if you set them up right.

I’d just start a test project/scene/folder/whatever and play around with Node2Ds and some basic tutorials until you find something you’re comfortable with using for your movement. Mob size over time would theoretically be a simple script shrinking or growing the mobs main node, although it may require also shrinking or growing child nodes depending on how the engine works.

1 Like

You could use actual 3D techniques with 4x4 matrix mathematics and a fake camera frustum.

Switching to a 2.5D you could use a Sprite3D and/or render your 2D scenes in Godot’s 3D space.

You’re probably doing fine using a simple scale over time, play with your numbers, tweak until it looks good enough. Is there anything in particular that is giving you trouble?

Thank you for explaining. IIUC, i could do all the math with setting positions by frame, under physical_process?

I tried both 2d and 3d tutorial, building a 3d asset is over complicated to me. I can deal with math, but i have very basic tools for making the proper assets.

If you give objects a velocity, then you don’t need to set their positions manually, and the engine will move objects and detect where exactly they collide. If you set positions frame by frame, you’ll have to also do extra coding for collision detection/handling.