✅ Solved: Data Binding World x, y Issue and Whether Constraint Can Use Parent Artboard as Target
Hi, I made an animation for when the player earns coins.
I use Distance Constraints to make the coins fly toward a target (the UI element showing the coin amount).
https://rive.app/s/_f0G8kEaAUODU9AR1mYnFA/?runtime=rive-renderer
The animation is triggered using the reward.play trigger.
———
The Distance Constraint’s Target cannot be set to an element from the Parent Artboard.
To make this animation reusable across different pages:
Workaround in Editor:
Parent artboard’s Data Model: Main
Reward animation artboard’s Data Model: Reward
Main includes an instance of Reward.
Parent Artboard has a coin amount UI element.
In the Parent Artboard, the coin amount UI’s World X/Y are Target → Source bound to `reward.coinViewX` and `reward.coinViewY`.
The Child Artboard (coin reward animation) also uses Data Binding to read those coordinates and apply them to its local coin reward UI’s x and y.
(Source in screenshot is `Main → reward` but also tried use `Reward`)I then set the coins’ Distance Constraint Target to this local coin reward UI.
This works perfectly in Rive Editor.
In the Editor’s playback, I can see `main.reward.coinViewX` and `main.reward.coinViewY` showing the correct coordinates (see video below).
However in both React Native and Web runtime:
https://rive.app/s/_f0G8kEaAUODU9AR1mYnFA/?runtime=rive-renderer
coinViewX and coinViewY never update from 0, 0.
As a result, the coins do not fly to the correct position.
I can still retrieve the 0, 0 values in Runtime and successfully trigger the animation via reward.play, so the binding exists — it just doesn’t seem to update.
———
Could my Data Binding setup be wrong for Runtime usage?
Is it impossible to retrieve World X/Y coordinates in Runtime?
Is there another way to reference a parent element or a specific coordinate so that a child Artboard can set a constraint target correctly?