Skip to content

Latest commit

 

History

History
219 lines (141 loc) · 5.42 KB

NetworkRigidbodyComponent.md

File metadata and controls

219 lines (141 loc) · 5.42 KB

Class: NetworkRigidbodyComponent

Types

<ComponentProps>

See <ComponentProps>


<NetworkRigidbodyComponentProps>

A portion of the configuration object to pass to the NetworkRigidbodyComponent constructor.

type NetworkRigidbodyComponentPropsV1 = {
  position?: Position | undefined;
  rotation?: Rotation | undefined;
  isKinematic?: boolean | undefined;
  isServerSleeping?: boolean | undefined;
  velocity?: Velocity | undefined;
  angularVelocity?: AngularVelocity | undefined;
};

type NetworkRigidbodyComponentProps = NetworkRigidbodyComponentPropsV1;

Since v1

  • position (optional, default { x: 0, y: 0, z: 0 }) <Position>
  • rotation (optional, default { x: 0, y: 0, z: 0, w: 1 }) <Rotation>
  • isKinematic (optional, default false) <boolean>
  • isServerSleeping (optional, default false) <boolean>
  • velocity (optional, default { x: 0, y: 0, z: 0 }) <Velocity>
  • angularVelocity (optional, default { x: 0, y: 0, z: 0 }) <AngularVelocity>

Constructors

new NetworkRigidbodyComponent(props)

Creates a versioned NetworkRigidbody component.

import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

NetworkRigidbodyComponent.fromBinary(reader, version)

See Component.fromBinary(reader, version)

Properties

Note that the following properties are sorted in order of appearance when decoding component binary data.

hash

See Component.hash


name

See Component.name


version

See Component.version


position

Position of the prefab this component is attached to.

import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const position = component.position;
// `position` is `{ x: 0, y: 0, z: 0 }`

rotation

Rotation of the prefab this component is attached to.

import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const rotation = component.rotation;
// `rotation` is `{ x: 0, y: 0, z: 0, w: 1 }`

isKinematic

Whether the prefab this component is attached to is kinematic or not.

  • Since: v1
  • <boolean>
import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const isKinematic = component.isKinematic;
// `isKinematic` is `false`

isServerSleeping

Whether the prefab this component is attached to is sleeping or not.

  • Since: v1
  • <boolean>
import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const isServerSleeping = component.isServerSleeping;
// `isServerSleeping` is `false`

velocity

Velocity of the prefab this component is attached to.

import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const velocity = component.velocity;
// `velocity` is `{ x: 0, y: 0, z: 0 }`

angularVelocity

Angular velocity of the prefab this component is attached to.

import { NetworkRigidbodyComponent } from 'att-string-transcoder';

const componentVersion = 1;
const component = new NetworkRigidbodyComponent({ version: componentVersion });

const angularVelocity = component.angularVelocity;
// `angularVelocity` is `{ x: 0, y: 0, z: 0 }`

Methods

toBinary(version?)

See Component.toBinary(version?)


write(writer, version?)

See Component.write(writer, version?)