We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Vector3

Vector3 is going to be the first Snek Object that can hold a reference to another Snek Object. It's a collection type: a type that holds other types.

Arrays, lists, dictionaries, and sets are all examples of collection types. We won't implement all of those types in this course, but they each will follow the same pattern that we're establishing here with Vector3.

Vector3 is similar to a Python tuple that contains exactly 3 "SnekObject" elements.

Assignment

    The v_vector3 field is not a pointer to a vector3; it's directly allocated inside the struct. We can do this because we know the size of the vector (it's only 3 pointers wide) in advance.