Studio GuideWorld SDK Guide
Log In

A red error line appears when using the Vector3 operator.

When editing the ZEPETO script with VSCode editor, Vector3 operation is displayed as an error.

This error is only shown in the script editor, and there is no issue with the actual build and play.

To prevent red error lines from appearing in VSCode, you can use the following methods.


Change TypeScript version in VSCode

Change the TypeScript version to the Workspace version using the following guide.

📘

Please refer to the following guide. VSCode editor error


Using operator methods

Instead of Vector3 operations, use methods such as Vector3.op_Addition.

  • The following code is an example of adding two Vector3 values using Vector3.op_Addition.
const v1 = new Vector3(0,1,0);
const v2 = new Vector3(0,1,1);

// Result: (0,2,1)
Vector3.op_Addition(v1, v2);

  • The available Vector operators are as follows:
MethodDescription
op_Addition($a: Vector3, $b: Vector3)Add the values of two Vector3.
op_Subtraction($a: Vector3, $b: Vector3)Subtract the second Vector3 from the first Vector3.
op_Multiply($a: Vector3, $d: number)Multiply Vector3 by number.
op_Division($a: Vector3, $d: number)Divide Vector3 by number.

👍

Tips

Vector2 also has the same operator methods.