Discuss Scratch

CodeMaster_TheGreat
Scratcher
25 posts

Variables To Represent Vectors

I wanted to create a 3d raytracer but it's quite annoying to have :
  • Direction.X
    Direction.Y
    Direction.Z
    Ray Position.X
    Ray Position.Y
    Ray Position.Z
    Object Position.X
    Object Position.Y
    Object Position.Z
    Object Type
    Object Color.Red
    Object Color.Blue
    Object Color.Green
    Other Object Shape Parameters
    Emmision Color.Red
    Emmision Color.Blue
    Emmision Color.Green
    Emmision Strength
    Emmited Light.Red
    Emmited Light. Blue
    Emmited Light.Green

And Remember these all have to be Different Variables or Lists
So my suggestion is to have an option for variables to hold a fixed number of values like 2 or 3 so that You can represent things like velocities and directions in one variable and to have multi dimensional lists so that a list of colors in RGB can be represented together.
These changes would make my project into using only:
  • Direction
    Ray Position
    Object Position
    Object Type
    Object Color
    Other Object Shape Parameters
    Emission Color
    Emission Strength
    Emitted Light
As you can see this makes things much easier to manage
hydrofungus
Scratcher
1000+ posts

Variables To Represent Vectors

But would this be too advanced for Scratch? Looks like that for me.
CodeMaster_TheGreat
Scratcher
25 posts

Variables To Represent Vectors

I think it would make it easier for new comers
There is a way to make multi dimensional lists in scratch but it is very complicated. You also than have to deal with looping etc. so multi dimensional lists are going to make it easier for people to understand
Also, vectors are much more convenient than lists. So they should make designing complex projects easier
hydrofungus
Scratcher
1000+ posts

Variables To Represent Vectors

CodeMaster_TheGreat wrote:

I think it would make it easier for new comers
There is a way to make multi dimensional lists in scratch but it is very complicated. You also than have to deal with looping etc. so multi dimensional lists are going to make it easier for people to understand
Also, vectors are much more convenient than lists. So they should make designing complex projects easier
What kind of new comers would make a 3D project?
CodeMaster_TheGreat
Scratcher
25 posts

Variables To Represent Vectors

No, which newcomer would know how to make a 2d list
I once tried to make sudoku on scratch. It took me twice as much time as it should have because I couldnt figure out how to make a 2d list and how to stop looping
hydrofungus
Scratcher
1000+ posts

Variables To Represent Vectors

CodeMaster_TheGreat wrote:

No, which newcomer would know how to make a 2d list
I once tried to make sudoku on scratch. It took me twice as much time as it should have because I couldnt figure out how to make a 2d list and how to stop looping

I don’t really think these blocks have much use. It would be very confusing for a lot of people, while it only helps a few.
CodeMaster_TheGreat
Scratcher
25 posts

Variables To Represent Vectors

CodeMaster_TheGreat
Scratcher
25 posts

Variables To Represent Vectors

insertatoflist

itemoflist

setpositionofto

That was all I wanted

medians
Scratcher
1000+ posts

Variables To Represent Vectors

1. 2D lists aren't in Scratch and are rejected to add basically due to them being too complex. And same for 3D (or you could just use a list with 2 or 3 values).
2. You can categorize blocks like this:
block ::category
Ex:
hello ::looks
hello
For More Blocks, and custom block arguments, it should be ::custom and ::custom-arg. You can use a grey color by putting grey as the category.
WindowsMeRules2000
Scratcher
500+ posts

Variables To Represent Vectors

CodeMaster_TheGreat wrote:

I wanted to create a 3d raytracer but it's quite annoying to have :
  • Direction.X
    Direction.Y
    Direction.Z
    Ray Position.X
    Ray Position.Y
    Ray Position.Z
    Object Position.X
    Object Position.Y
    Object Position.Z
    Object Type
    Object Color.Red
    Object Color.Blue
    Object Color.Green
    Other Object Shape Parameters
    Emmision Color.Red
    Emmision Color.Blue
    Emmision Color.Green
    Emmision Strength
    Emmited Light.Red
    Emmited Light. Blue
    Emmited Light.Green

And Remember these all have to be Different Variables or Lists
So my suggestion is to have an option for variables to hold a fixed number of values like 2 or 3 so that You can represent things like velocities and directions in one variable and to have multi dimensional lists so that a list of colors in RGB can be represented together.
These changes would make my project into using only:
  • Direction
    Ray Position
    Object Position
    Object Type
    Object Color
    Other Object Shape Parameters
    Emission Color
    Emission Strength
    Emitted Light
As you can see this makes things much easier to manage
No support, too complicated
Zydrolic
Scratcher
1000+ posts

Variables To Represent Vectors

(removed — i can english)

Last edited by Zydrolic (Sept. 11, 2023 16:40:41)

GIitchInTheMatrix
Scratcher
1000+ posts

Variables To Represent Vectors

Zydrolic wrote:

* 3D Scratch features are rejected, as far as I can see this is a 3D suggestion.

The Official List of Rejected Suggestions, Top Sticky by Za-Chary wrote:

1.7 3D Scratch
This block, and others, could be used with a z-axis in the project stage to make it easier to create 3D projects. However, Scratch is a language that is designed to be as easy as possible for beginners to learn. The purpose of Scratch is to teach beginners basic programming concepts, which is best accomplished with a 2D interface. Adding a 3D interface could make Scratch more difficult to learn and teach. This suggestion also includes the possibility for virtual-reality “Scratch VR” features, where a lot of the same difficulties come up; for more information, see this post.

For those who are interested, it may be worth checking out Beetle Blocks or CreatiCode. They are block-based programming languages similar to the Scratch editor, but with 3D features. There is another similar program to Scratch that contains block programming with 3D features, called Starlogo TNG.
* I may be wrong. Anyway, TOLoRS can be viewed here.
They aren’t suggesting 3d, they’re suggesting essentially a new type of variable.
-Chloe
cookieclickerer33
Scratcher
1000+ posts

Variables To Represent Vectors

Snap has this, kind of it’s really just first class lists. but snap’s list system is completely different to scratches due to that making this extremely simple to code in for them

On the other hand adding this to scratch would require a rework of the entire list system to accommodate them now being first class data types (this would involve removing the “make a list” button too) as well as making lists even more complex to understand..

In order to get around this not much can be done other than adding a block that splits a value from a text and then putting the text in between the 2 numbers

Also this would add tables (lists of lists) that’s rejected
IndexErrorException
Scratcher
500+ posts

Variables To Represent Vectors

I mean it's not to bad to implement vectors using tables, but yes a built in vector would be nice.

At least 2d arrays are easy to implement in Scratch, and further dimensions are definitely possible.

The issue is this suggestion is quite over the head of most Scratchers who come here to talk and do mostly art based projects.
mcsquaggle
Scratcher
500+ posts

Variables To Represent Vectors

no support. i know most* of them but i dont know all of them i think they would be really confusing in general
*i do roblox studio witch have like.. Vector3 if that what you talk about

medians
Scratcher
1000+ posts

Variables To Represent Vectors

PaperMarioFan2022
Scratcher
1000+ posts

Variables To Represent Vectors

medians wrote:

Actually, would lists or this help?
https://scratch.mit.edu/discuss/topic/37185/
https://scratch.mit.edu/discuss/topic/58420/
I think those would help contribute to this suggestion. They also look pretty simple even though I don’t work with variables much.
gdfsgdfsgdfg
Scratcher
1000+ posts

Variables To Represent Vectors

just make variables yourself
-Valtren-
Scratcher
1000+ posts

Variables To Represent Vectors

Isn't multidimensional lists rejected?

TOLORS wrote:

1.6 2D lists
2D lists, also known as 2D arrays, nested lists, or matrices, are a type of data structure that allows you to put an entire list as an element of another list; that is, it allows you to put lists inside of lists. These sorts of data structures are used widely in other programming languages.

This block, and others, would allow you to create 2D lists to store information, sort of like a table. However, this is too complicated for what is supposed to be an introductory programming language. In addition, there are workarounds possible by using an ordinary list and an indexing function. For those who are interested, it may be worth checking out Snap!. It is a block-based programming language designed for more experienced programmers and has more advanced data structures than Scratch does.

addtosublistoflist

Powered by DjangoBB