Linker

A Linker is a feature of the Outline menu. Similar to a physics constraint, it “links” two physics-enabled entities together, connected by a joint. At least one of these entities should be Dynamic physics type for it to function. For examples on how to use a hinge type linker, check out the Motor node or the Iso Car template.

There are three types of Linkers:
Point – A point Linker is a physics constraint between two physics objects with a pivot point that describes the ‘ballsocket’ between them. This is useful for something like a light hanging from the ceiling by a string.
Fixed – A fixed Linker constrains two physics objects by keeping them the same relative distance from each other. In a way, it pins them together.
Hinge – A hinge Linker constrains physics objects along an axis by a hinge. The hinge constraint is unique because you can apply force to the hinge to rotate the axis. This can be used to simulate wheels that rotate around an axis, for example.

Note: Currently if you want to access a Linker in the start() function of a script, you’ll need to call .init() on it first.

Function Description
enableMotor(value)

Enables/disables a hinge type Linker’s angular motor.

entityA() Returns the first entity linked by the Linker. Whichever one is considered “entity A” depends on which one is higher in the scene editor at the time of creating the Linker.
entityB() Returns the second entity linked by the Linker. Whichever one is considered “entity B” depends on which one is higher in the scene editor at the time of creating the Linker.
hingeAxis() Returns the hinge axis of a hinge type Linker.
init() Initializes the Linker. This is necessary for accessing a Linker in the start() method.
isRemoved() Returns true if the Linker is removed, false if not.
maxMotorImpulse() Returns the max motor impulse of the hinge type Linker.
motorVelocity()

Returns the motor velocity of the hinge type Linker.

position()

Returns the position of the Linker.

remove()

Removes/disables the Linker.

setEntities(entity1, entity2)

Sets the entities that the Linker connects.

setHingeAxis(value)

Set the hinge axis of a hinge type Linker.

setMaxMotorImpulse(value)

Sets the max motor impulse of the hinge type Linker.

setMotorVelocity(value)

Sets the motor velocity of the hinge type Linker.

setPosition(value)

Sets the position of the Linker.

setType(value) Sets the Linker type. Accepted values are “kPoint”, “kFixed”, “kHinged”.
type() Returns the type of the Linker. Possible values: “kPoint”, “kFixed”, “kHinged”.
Static Function Description
entityLinkers(entity)

Returns an array of all Linkers attached to the given entity.


enableMotor(value)

Enables/disables a hinge type Linker’s angular motor.

Parameters

boolean value – true to enable, false to disable

↑ Back to top


entityA()

Returns the first entity linked by the Linker. Whichever one is considered “entity A” depends on which one is higher in the scene editor at the time of creating the Linker.

Returns

Entity the first entity linked by the Linker.

↑ Back to top


entityB()

Returns the second entity linked by the Linker. Whichever one is considered “entity B” depends on which one is higher in the scene editor at the time of creating the Linker.

Returns

Entity the second entity linked by the Linker.
↑ Back to top


hingeAxis()

Returns the hinge axis of a hinge type Linker.

Returns

Vec3 the {x, y, z} hinge axis
↑ Back to top


init()

Initializes the Linker. This is necessary for accessing a Linker in the start() method.

function start(){
  let linker = this.scene().find("Linker")[0];
  linker.init();
  // do whatever you need to with your linker now.
}

↑ Back to top


isRemoved()

Returns true if the Linker is removed, false if not.

Returns

boolean true if Linker is removed, false if not

↑ Back to top


maxMotorImpulse()

Returns the max motor impulse of the hinge type Linker.

Returns

number the max motor impulse
↑ Back to top


motorVelocity()

Returns the motor velocity of the Linker.

Returns

number the motor velocity of the Linker
↑ Back to top


position()

Returns the position of the Linker.

Returns

Vec3 the {x, y, z} position of the Linker
↑ Back to top


remove()

Removes/disables the Linker.

↑ Back to top


setEntities(entity1, entity2)

Sets the entities that the Linker connects.

Parameters

Entity entity1 – the first entity to connect to the Linker
Entity entity2 – the second entity to connect to the Linker
↑ Back to top


setHingeAxis(value)

Set the hinge axis of a hinge type Linker.

Parameters

Vec3 value the {x, y, z} hinge of the Linker
↑ Back to top


setMaxMotorImpulse(value)

Sets the max motor impulse of the hinge type Linker.

Parameters

number value the max motor impulse
↑ Back to top


setMotorVelocity()

Sets the motor velocity of the hinge type Linker.

Parameters

number value the motor velocity
↑ Back to top


setPosition(value)

Sets the position of the Linker.

Parameters

Vec3 value the {x, y, z} position of the Linker.
↑ Back to top


setType(value)

Sets the Linker type. Accepted values are “kPoint”, “kFixed”, “kHinged”.

Parameters

string value the type of the Linker
↑ Back to top


type()

Returns the Linker type. Possible values: “kPoint”, “kFixed”, “kHinged”.

Returns

string the type of the Linker
↑ Back to top


entityLinkers(entity)

Returns an array of all Linkers attached to the given entity. This is a static function, so it is called like this: Linker.entityLinkers(entity);

Parameters

Entity entity the entity

Returns

array the array of Linkers attached to the entity
↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?