GeometricPin
A structure that identifies a local transform relative to an entity or entity’s animating skeletal joint.
Declaration
struct GeometricPinOverview
A geometric pin has a base transform and allows an optional offset relative to the base transform. The base transform is only available when the pin attaches to an entity. When a geometric pin does not attach to any entity (i.e. GeometricPin/entity is nil), the pin is just a floating local transform relative to some space to be defined. The pin’s query function such as GeometricPin/position or GeometricPin/orientation returns the local offset in this case.
After a geometric pin has attached to an entity, or GeometricPin/entity is not nil, the base transform may be available. If you construct a geometric pin with a generic name, the base transform resolves to the transform of the pin’s owning entity. If you construct a geometric pin with a skeletal joint name, the base transform resolves to the current transform of the skeletal joint with the matching joint name. When the base transform is available, the pin’s query function such as GeometricPin/position or GeometricPin/orientation returns the base transform with the offset applied.
You can attach a pin to an entity by creating a GeometricPin, adding it to a GeometricPinsComponent, and finally setting the GeometricPinsComponent to an Entity.
let pin = GeometricPin(named: "genericPin")
let skeletalJointPin = GeometricPin(named: "animatingPin", skeletalJointName: "hand")
var pinsComponent = GeometricPinsComponent()
pinsComponent.set(pin)
pinsComponent.set(skeletalJointPin)
let entity = Entity()
entity.components.set(pinsComponent)Another way to attach a pin is to add the GeometricPin to the pins collection directly.
let entity = Entity()
let pin = entity.pins.set(named: "genericPin")
let skeletalJointPin = entity.pins.set(named: "animatingPin", skeletalJointName: "hand")Note that when adding a geometric pin the API does not validate the skeletal joint name. The validation only happens when the base transform is evaluating, for example during the call to GeometricPin/position or GeometricPin/orientation. If the skeletal joint name does not match any valid skeletal joint, those query functions return nil.
Each geometric pin has a unique name to identify itself from other pins on an entity. You can use the subscript operator to retrieve a pin.
// To retrieve the skeletal joint pin in the previous snippet:
let retrievedPin = pinsComponent["animatingPin"]Topics
Operators
Initializers
init(named:offsetPosition:offsetOrientation:)init(named:skeletalJointName:offsetPosition:offsetOrientation:)