Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make 3D??
- XxHeartOFStonexX
-
9 posts
How do I make 3D??
I have seen people make 3D projects and I am amazed like how? Ikr like dude its really astonishing to see people make this stuff!
- -SuperCoolStudioz-
-
3 posts
How do I make 3D??
we literally can’t tell you here. it would fill up about 25% of the page
- bsteichman
-
500+ posts
How do I make 3D??
99% of these 3D projects use pen, so before you learn how to make 3D projects I would learn how to make pen games. start by making a simple 2D pen game
- zoviarTorty
-
5 posts
How do I make 3D??
https://scratch.mit.edu/projects/925814855/ and https://scratch.mit.edu/projects/933215845/ may help you with this task
- XCBFS
-
14 posts
How do I make 3D??
Many people succeed to do 3D on Scratch, and there is a lot of way to do it (some are easier than other).
The easiest way to do it, is by ray casting : You have a ray that start to the player, to search the distance between wall and player (more ray = more precise). With all the distance you've put in a list, you draw some verticals lines (with the pen extension), more the distance if far, more the line will be short.
But you have a lot of tuto on youtube for ray casting
The easiest way to do it, is by ray casting : You have a ray that start to the player, to search the distance between wall and player (more ray = more precise). With all the distance you've put in a list, you draw some verticals lines (with the pen extension), more the distance if far, more the line will be short.
But you have a lot of tuto on youtube for ray casting
- s714655
-
100+ posts
How do I make 3D??
There are many ways to do 3d in scratch. The main ways are clones/sprites, raycasting(pen), and object rendering(pen and mostly uses lines or Tri fillers). You can go to a three dementional point with screenx = x / z and screeny = y / z. Its good to have a focal length wich makes the z value not look as bad on screen (idk how to explain but it kinda stretches the points). I use x * (focal / z) and y * (focal / z) or set z to focal / z before doing x * z and y * z. You can make a custom block for this and the size if your using clones is 100 * (focal / z).
There are two types of rotation that I use; object rotation, and camera rotation. Object rotation is like having an object as a model and rotating the model but camera rotation rotates the world around the camera.
rx = rotation X of camera (up and down)
ry = rotation Y of camera (left and right)
(you don't need a z rotation for game cameras so this will do)
I forgot to mention that the object rotation thing only rotates around the z axis, to rotate around the other axes you can swap out the x and y for the “horizontal” and “vertical” cords of that axis. x = yz, y = xz, z = xy.
For camera rotation you want to move the x y z points by - camera x y z before you rotate then project it onto the screen. The rotation means that no matter the camera rotation, z will be infront of the camera. Because of this if the z of the point is less than 0 than its behind the camera, you can also create a near plane to clip it when its close to the camera. You can set the near plane variable to anything but its perferred to be (I think) around 1 - 100 for scratch. I use 30 - 50.
If you want a little optimisation you can check its distance to the camera before rotating:
x = x - camera
y = y - camera
z = z - camera
distance = sqrt(x^2 + y^2 + z^2)
if(distance > near && distance < far) then
rotate(x, y, z) // camera already been subtracted from point above
if(rotatedz > 0) then
project
with this case I prefer you don't use the near for z clipping, just use 0. Use the near and far for distance clipping. The far is a number like 500 or 1000.
Those are the basics of 3d in scratch ig. If you have any questions don't hesitate to ask!
There are two types of rotation that I use; object rotation, and camera rotation. Object rotation is like having an object as a model and rotating the model but camera rotation rotates the world around the camera.
Object rotation:I don't use object rotation a lot in games…
rotatedX = x * cos(directoin) - y * sin(direction)
rotatedY = x * sin(direction) + y * cos(direction)
rx = rotation X of camera (up and down)
ry = rotation Y of camera (left and right)
(you don't need a z rotation for game cameras so this will do)
Camera rotation:
rotatedX = z * sin(ry) + x * cos(ry)
rotatedZ = z * cos(ry) - x * sin(ry)
rotatedY = rotatedZ * sin(rx) + y * cos(rx)
rotatedZ = rotatezZ * cos(rx) - y * sin(rx)
I forgot to mention that the object rotation thing only rotates around the z axis, to rotate around the other axes you can swap out the x and y for the “horizontal” and “vertical” cords of that axis. x = yz, y = xz, z = xy.
For camera rotation you want to move the x y z points by - camera x y z before you rotate then project it onto the screen. The rotation means that no matter the camera rotation, z will be infront of the camera. Because of this if the z of the point is less than 0 than its behind the camera, you can also create a near plane to clip it when its close to the camera. You can set the near plane variable to anything but its perferred to be (I think) around 1 - 100 for scratch. I use 30 - 50.
If you want a little optimisation you can check its distance to the camera before rotating:
x = x - camera
y = y - camera
z = z - camera
distance = sqrt(x^2 + y^2 + z^2)
if(distance > near && distance < far) then
rotate(x, y, z) // camera already been subtracted from point above
if(rotatedz > 0) then
project
with this case I prefer you don't use the near for z clipping, just use 0. Use the near and far for distance clipping. The far is a number like 500 or 1000.
Those are the basics of 3d in scratch ig. If you have any questions don't hesitate to ask!
- The_Cool_Scratch_Guy
-
87 posts
How do I make 3D??
If it doesn't require awesome graphics then even size and a little coordinate manipulation can do the trick. Check out some of my 3d project s, they're simple ones but they look good with what I mentioned above.
- s714655
-
100+ posts
How do I make 3D??
Nice answer! ig. Not sure if griffpatch will see the comment let alone read it, you know how many messages he has? Simple; Talk To Griffpatch.
- NormalFradOfficial
-
29 posts
How do I make 3D??
Nice answer! ig. Not sure if griffpatch will see the comment let alone read it, you know how many messages he has? Simple; Talk To Griffpatch.
I meant watch his tutorials
- NormalFradOfficial
-
29 posts
How do I make 3D??
just add this script
Last edited by NormalFradOfficial (March 31, 2025 12:34:35)
- player3676
-
100+ posts
How do I make 3D??
just add this script
Last edited by player3676 (April 8, 2025 07:30:51)
- sleepground1013
-
12 posts
How do I make 3D??
umm…so hard…ㅠㅠ There are many ways to do 3d in scratch. The main ways are clones/sprites, raycasting(pen), and object rendering(pen and mostly uses lines or Tri fillers). You can go to a three dementional point with screenx = x / z and screeny = y / z. Its good to have a focal length wich makes the z value not look as bad on screen (idk how to explain but it kinda stretches the points). I use x * (focal / z) and y * (focal / z) or set z to focal / z before doing x * z and y * z. You can make a custom block for this and the size if your using clones is 100 * (focal / z).
There are two types of rotation that I use; object rotation, and camera rotation. Object rotation is like having an object as a model and rotating the model but camera rotation rotates the world around the camera.Object rotation:I don't use object rotation a lot in games…
rotatedX = x * cos(directoin) - y * sin(direction)
rotatedY = x * sin(direction) + y * cos(direction)
rx = rotation X of camera (up and down)
ry = rotation Y of camera (left and right)
(you don't need a z rotation for game cameras so this will do)Camera rotation:
rotatedX = z * sin(ry) + x * cos(ry)
rotatedZ = z * cos(ry) - x * sin(ry)
rotatedY = rotatedZ * sin(rx) + y * cos(rx)
rotatedZ = rotatezZ * cos(rx) - y * sin(rx)
I forgot to mention that the object rotation thing only rotates around the z axis, to rotate around the other axes you can swap out the x and y for the “horizontal” and “vertical” cords of that axis. x = yz, y = xz, z = xy.
For camera rotation you want to move the x y z points by - camera x y z before you rotate then project it onto the screen. The rotation means that no matter the camera rotation, z will be infront of the camera. Because of this if the z of the point is less than 0 than its behind the camera, you can also create a near plane to clip it when its close to the camera. You can set the near plane variable to anything but its perferred to be (I think) around 1 - 100 for scratch. I use 30 - 50.
If you want a little optimisation you can check its distance to the camera before rotating:
x = x - camera
y = y - camera
z = z - camera
distance = sqrt(x^2 + y^2 + z^2)
if(distance > near && distance < far) then
rotate(x, y, z) // camera already been subtracted from point above
if(rotatedz > 0) then
project
with this case I prefer you don't use the near for z clipping, just use 0. Use the near and far for distance clipping. The far is a number like 500 or 1000.
Those are the basics of 3d in scratch ig. If you have any questions don't hesitate to ask!
- Discussion Forums
- » Help with Scripts
-
» How do I make 3D??