Skip to content

[2.0] Stabilize behavior of createVector() with zero arguments #8156

@GregStanton

Description

@GregStanton

[2.0] Stabilize behavior of createVector() with zero arguments

This issue addresses, but does not fully resolve, #8117.

Documentation

Although the reference page for 1.x and the reference page for 2.0 both indicate that it's possible to use createVector() with no arguments, neither reference page specifies the behavior in that case.

Current behavior

Currently, the actual behavior in both 1.x and 2.0 is that createVector() creates a vector with components [0, 0, 0]. This made sense in 1.x, where all vectors were represented as 3D vectors, but it makes less sense in 2.0, which aims to support vectors of all possible dimensions.

Note: The behavior appears to arise from the Vector constructor, in which [0, 0, 0] is hardcoded.

Desired behavior?

Perhaps the most reasonable option is to create a zero-dimensional vector, i.e. a vector instance with zero components. Those components could be set later with e.g. the x and y fields. This seems like the most logical and predictable behavior.

Compatibility

It appears that it's not uncommon to use createVector() (without arguments) as a shortcut in 1.x, but I suppose we could add the old behavior back in with the compatibility add-on? Do you have any thoughts on this @davepagurek?

Task list

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions