Quick answer: Set the child to its desired position and angle first, then call Pin to Object with mode Position & angle. If you pin first, the child sticks to the parent’s origin forever. If you pick the wrong mode, the child drifts when the parent rotates.
You attach a sword sprite to a player character with the Pin behavior. The player walks around and the sword follows. Then the player turns to face left, and the sword stays floating at the same world offset — pointing stubbornly to the right while the character faces the other way. The pin is working, but it is pinning the wrong dimension.
The Three Pin Modes
Construct 3’s Pin behavior has three modes, selected when you call the Pin to Object action:
- Position: the child keeps the same world-space offset from the parent. When the parent moves, the child moves by the same delta. When the parent rotates, the child does not rotate around the parent.
- Angle: the child keeps the same relative angle. When the parent rotates, the child rotates by the same amount but stays at its current world position.
- Position & angle: the child follows both position and rotation. This is what most people mean when they say “pin.”
If your attachment needs to behave like a child node in a transform hierarchy (a weapon, a hat, a shield, a particle effect that spins with a propeller), you almost always want Position & angle.
The Symptom
A pinned child does one of these:
- Stays at a fixed world offset when the parent rotates (Position-only mode).
- Rotates in place when the parent moves (Angle-only mode).
- Jumps to the parent’s origin when the scene starts (pinned before positioning).
- Works for one instance but breaks for duplicated instances (pin condition picked the wrong “object” reference).
The Fix
Step 1: Position the child first.
In the event that creates or spawns the attachment, set its position and angle to the correct initial offset before calling Pin. The pin action snapshots the current difference — whatever that difference is at the moment of the call is what the pin will preserve.
On created obj_player
→ obj_sword: Set position to (obj_player.X + 20, obj_player.Y)
→ obj_sword: Set angle to obj_player.Angle
→ obj_sword: Pin to obj_player (Position & angle)
Step 2: Use Position & angle mode.
In the Pin action, the mode dropdown has three choices. Pick Position & angle for attachments that should follow the parent’s rotation. If you picked a different mode to start with, Unpin and re-pin with the correct mode — you cannot change the mode without unpinning first.
Step 3: Handle spawned instances correctly.
If you spawn multiple players and each has its own sword, your pin events must use the right scoping. Use System: Pick Nth instance, Pick by UID, or a family to ensure you pin each sword to its own player, not to the first-picked player for all swords.
On created obj_player
System: Pick obj_sword where obj_sword.player_uid = obj_player.UID
→ obj_sword: Pin to obj_player
When You Need Offsets Relative to Rotation
Sometimes you want the child to sit at a fixed local offset that rotates with the parent — like a muzzle flash attached to the tip of a rotating gun. The pin preserves whatever offset existed at pin time, so if you set the child to the correct local offset before pinning, it will stay there and follow rotation correctly.
To compute the world position that corresponds to a local offset:
offset_x = cos(parent.Angle) * 20 - sin(parent.Angle) * 0
offset_y = sin(parent.Angle) * 20 + cos(parent.Angle) * 0
obj_muzzle: Set position to (parent.X + offset_x, parent.Y + offset_y)
obj_muzzle: Set angle to parent.Angle
obj_muzzle: Pin to parent (Position & angle)
With Position & angle mode, the 20-unit offset will rotate around the parent correctly from then on.
Verifying the Fix
In the layout, place a parent with a pinned child. In the event sheet, add a debug key that rotates the parent by 5 degrees per frame. Run the game and hold the key. The child should orbit around the parent smoothly at a constant distance. If it drifts outward or stays in place, the mode is wrong. If it suddenly jumps to the parent’s position, the pin happened before positioning.
“Pin is not a parent-child hierarchy — it is a snapshot of the offset at the moment you call it. Position first, then pin, and pick Position & angle unless you really mean one of the others.”
Related Issues
For Construct 3 family and instance variable issues, see Construct 3 family instance variables not saving. For collision offset problems, see Construct 3 collision not detected between objects. For layout restart bugs, see Construct 3 global variable reset on layout restart.
The Pin behavior is a snapshot, not a constraint. Position the child exactly where you want it first, then pin it in place.