ObjectTarget Class

This type is an EasyAR Sense API in C#: ObjectTarget . Some descriptions may not apply to Unity environment on this page.

This type is partially wrapped into Unity components: ObjectTargetController . Members and instances of this type are not required to be used directly in most situations. Use this type by ObjectTargetController.Target instead of creating new instances when a few unwrapped API is desired for use.

Description

ObjectTarget represents 3d object targets that can be tracked by ObjectTracker .

The size of ObjectTarget is determined by the obj file. You can change it by changing the object scale, which is default to 1.

A ObjectTarget can be tracked by ObjectTracker after a successful load into the ObjectTracker using ObjectTracker.loadTarget .


Methods

createFromParameters

C#

public static Optional<ObjectTarget> createFromParameters( ObjectTargetParameters parameters)

Creates a target from parameters.

createFromObjectFile

C#

public static Optional<ObjectTarget> createFromObjectFile(string path, StorageType storageType, string name, string uid, string meta, float scale)

Creats a target from obj, mtl and jpg/png files.

scale

C#

public virtual float scale()

The scale of model. The value is the physical scale divided by model coordinate system scale. The default value is 1. (Supposing the unit of model coordinate system is 1 meter.)

boundingBox

C#

public virtual List< Vec3F > boundingBox()

The bounding box of object, it contains the 8 points of the box.

Vertices’s indices are defined and stored following the rule:

  4-----7
 /|    /|
5-----6 |    z
| |   | |    |
| 0---|-3    o---y
|/    |/    /
1-----2    x

setScale

C#

public virtual bool setScale(float scale)

Sets model target scale, this will overwrite the value set in the json file or the default value. The value is the physical scale divided by model coordinate system scale. The default value is 1. (Supposing the unit of model coordinate system is 1 meter.)

It is needed to set the model scale in rendering engine separately.

It also should been done before loading ObjectTarget into ObjectTracker using ObjectTracker.loadTarget .

runtimeID

C#

public override int runtimeID()

Returns the target id. A target id is a integer number generated at runtime. This id is non-zero and increasing globally.

uid

C#

public override string uid()

Returns the target uid. A target uid is useful in cloud based algorithms. If no cloud is used, you can set this uid in the json config as a alternative method to distinguish from targets.

name

C#

public override string name()

Returns the target name. Name is used to distinguish targets in a json file.

setName

C#

public override void setName(string name)

Set name. It will erase previously set data or data from cloud.

meta

C#

public override string meta()

Returns the meta data set by setMetaData. Or, in a cloud returned target, returns the meta data set in the cloud server.

setMeta

C#

public override void setMeta(string data)

Set meta data. It will erase previously set data or data from cloud.