Skip to content

ARC Entity (Script Reference)

Giorgio edited this page Jul 7, 2021 · 3 revisions

SWITCH TO MANUAL

Description

Represents an object in the current session whose position and rotation must be synchronised across the network. This script must be at the root of a GameObject. Can have a Rigidbody. Users can interact with it.

Properties

public bool isMoving If the object is moving, it is sending/receiving network updates.
public bool isInteracting Whether a user has grabbed this entity.
public ARCUser handler The user that is interacting with this entity, null otherwise.

Events

public UnityEvent _grabEvent UnityEvent invoked when a user grabs this entity.
public UnityEvent _releaseEvent UnityEvent invoked when a user releases this entity.

Public Methods

public void SetPose(Vector3 position, Quaternion rotation) Server only, call via Command. Set position and rotation for an entity. Manually setting transform.position and transform.rotation on the host is preferable.
public void SetMotion(Vector3 velocity, Vector3 angularVelocity) Server only, call via Command. Set linear and angular velocity for an entity with a Rigidbody component attached to it.
public void Grab(ARCUser user, Vector3 position, Quaternion rotation) Server only, call via Command. Let user user at position position and rotation rotation grab an entity. Use ARCUser.localCameraPosition and ARCUser.localCameraRotation as arguments before invoking the Command.
public void Release(ARCUser user, Vector3 position, Quaternion rotation) Server only, call via Command. Let user user at position position and rotation rotation release this entity. The new entity position will be in front of the user when the function is called.
public void SetScale(float newScale) Server only, call via Command. Set the new uniform scale value for the entity. The value is clamped between Min Scale and Max Scale (see reference).
public void AddScale(float amount) Server only, call via Command. Add an amount to the current uniform scale value for the entity. The final value is clamped between Min Scale and Max Scale.
public void SetHandlingRotation(Quaternion rotation) Server only, call via Command. Set the entity orientation while it is being held by a user. The rotation is defined in the user's local space.
public void AddHandlingRotation(Quaternion rotation, bool local = true) Server only, call via Command. Add an amount to the current entity orientation while it is being held by a user. The rotation is defined in the user's local space. If local is false, the rotation will be considered in ARCSession.origin local space instead (EXPERIMENTAL).

Clone this wiki locally