Game Development Reference
Getting the Real-Time Position of the Projectile
In order to correctly position the elastic, you will need to access the real-time
position of the projectile. This is fairly easy to do so using game attributes and
Constrain Attribute behaviors. But you only need this information when the
project is grabbed. You don't want your elastic to follow the projectile once it is
thrown. You will use the Touch rule of the projectile to constrain the position
when the rule is verified; otherwise you will bring back the elastic to the original
Create two real game attributes named ''ProjectileX'' and ''ProjectileY.''
Open the Projectile actor in the Actor Editor. Drag and drop a Constrain
Attribute into the Touch rule and changegame.ProjectileX to
Projectile.Position.X. Drag and drop another Constrain Attribute behavior into
the Touch rule and change game.ProjectileY to Projectile.Position.Y. These two
behaviors are shown in Figure 6-16.
Figure 6-16. Constraining the position of the projectile