Skip to content

API reference Obsidian.API

Vector struct

Represents a three-dimensional vector. Uses Int32.

public struct Vector : IEquatable<Vector>, INetworkSerializable<Vector>

In Obsidian.API.

Constructors

Vector(int)

public Vector(int value);

Creates new instance of Vector with Vector.X, Vector.Y and Vector.Z set to value.

Parameters

value
Value of Vector.X, Vector.Y and Vector.Z.

Vector(int, int, int)

public Vector(int x, int y, int z);

Creates a new instance of Vector with specific values.

Parameters

x
Value of X coordinate.
y
Value of Y coordinate.
z
Value of Z coordinate.

Properties

Magnitude

public float Magnitude { get; }

Calculates magnitude of this Vector.

public SoundPosition SoundPosition { get; }

X

public int X { get; set; }

The X component of the Vector.

Y

public int Y { get; set; }

The Y component of the Vector.

Z

public int Z { get; set; }

The Z component of the Vector.

Methods

ChunkClamp()

public Vector ChunkClamp();

Returns Vector clamped to fit inside a single minecraft chunk.

ChunkClamped(int, int, int)

public static Vector ChunkClamped(int x, int y, int z);

Creates new Vector clamped to fit inside a single minecraft chunk.

Clamp(Vector, Vector)

public Vector Clamp(Vector min, Vector max);

Returns Vector clamped to the inclusive range of min and max.

public static Vector Clamp(Vector value, Vector min, Vector max);public static Vector Cross(Vector value1, Vector value2);public void Deconstruct(out int x, out int y, out int z);

Distance(Vector, Vector)

public static float Distance(Vector from, Vector to);

Calculates the distance between two Vectors.

public static int Dot(Vector value1, Vector value2);public override bool Equals(object obj);

Equals(Vector)

public bool Equals(Vector other);

Indicates whether this Vector is near equal to other.

public override int GetHashCode();

MagnitudeSquared()

public float MagnitudeSquared();

Calculates magnitude of this Vector squared.

public static Vector Read(INetStreamReader reader);public Vector Relative(Vector direction, int distance = 0);

ToString()

public override string ToString();

Returns Vector formatted as a String.

Returns

String representaion of this Vector.

public static void Write(Vector value, INetStreamWriter writer);

Operators

public static implicit operator VectorF(Vector position);public static bool operator !=(Vector a, Vector b);public static Vector operator %(int a, Vector b);public static Vector operator %(Vector a, int b);public static Vector operator %(Vector a, Vector b);public static Vector operator *(int a, Vector b);public static Vector operator *(Vector a, int b);public static Vector operator *(Vector a, Vector b);public static Vector operator +(int a, Vector b);public static Vector operator +(Vector a, (int, int, int) b);public static Vector operator +(Vector a, int b);public static Vector operator +(Vector a, Vector b);public static Vector operator -(int a, Vector b);public static Vector operator -(Vector a);public static Vector operator -(Vector a, int b);public static Vector operator -(Vector a, Vector b);public static Vector operator /(int a, Vector b);public static Vector operator /(Vector a, int b);public static Vector operator /(Vector a, Vector b);public static bool operator ==(Vector a, Vector b);

Fields

Backwards

public static readonly Vector Backwards;

A read-only field that represents Vector with coordinates (0, 0, -1).

CardinalDirs

public static readonly IEnumerable<Vector> CardinalDirs;

Enumerable array of Cardinal Directions

Down

public static readonly Vector Down;

A read-only field that represents Vector with coordinates (0, -1, 0).

East

public static readonly Vector East;

A read-only field that represents Vector with coordinates (1, 0, 0).

Forwards

public static readonly Vector Forwards;

A read-only field that represents Vector with coordinates (0, 0, 1).

Left

public static readonly Vector Left;

A read-only field that represents Vector with coordinates (-1, 0, 0).

North

public static readonly Vector North;

A read-only field that represents Vector with coordinates (0, 0, -1).

One

public static readonly Vector One;

A read-only field that represents Vector with coordinates (1, 1, 1).

public static readonly Vector Right;

A read-only field that represents Vector with coordinates (1, 0, 0).

South

public static readonly Vector South;

A read-only field that represents Vector with coordinates (0, 0, 1).

Up

public static readonly Vector Up;

A read-only field that represents Vector with coordinates (0, 1, 0).

West

public static readonly Vector West;

A read-only field that represents Vector with coordinates (-1, 0, 0).

Zero

public static readonly Vector Zero;

A read-only field that represents Vector with coordinates (0, 0, 0).

On this page