Game Development Reference
In-Depth Information
Figure 10-23. Trigonometry concept for the position of the weight at any time
By using the cosinus and sinus of the angle (α in Figure 10-23), you can derive
the value of x and y at point C. You use the magnitude function to calculate the
distance between two points.
Create a new rule and name it ''Sync the movement.'' The condition is
''Attribute''''game.InMovement'' is ''true.'' Then drag and drop three Constrain
Attribute behaviors into the rule and change:
Weight.Rotation to game.Rotation-90
Weight.Position.X to160+magnitude(Weight.Position.X-160,
Weight.Position.Y-100) * sin (-(game.rotation-90))
Weight.Position.Yto 100+magnitude(Weight.Position.X-160,
Weight.Position.Y-100) * cos (game.rotation-90)
Search WWH ::




Custom Search