Constrain a line to an actor question...
Hey all.
I've been looking all over for this one (even though I'm sure it's out there somewhere)-
I need a basic line to be able to constrain and/or move with my actor from a center point. Think the slingshot ropes in angry birds. I'm sure there's a million templates out there but since they're down it's hard to get an answer for this one. Any help would be appreciated.
Thanks!
I've been looking all over for this one (even though I'm sure it's out there somewhere)-
I need a basic line to be able to constrain and/or move with my actor from a center point. Think the slingshot ropes in angry birds. I'm sure there's a million templates out there but since they're down it's hard to get an answer for this one. Any help would be appreciated.
Thanks!
Comments
Have two other blocks, they will be your anchor points (set alpha to 0)
Anchor points - add global variable (mine are scene.Connector1/2.Position.X/Y)
More global variables game.BlockX/Y for me (the thing you are throwing)
Elastic on the right:
self.width = magnitude( scene.Connector1.Position.X - game.BlockX , scene.Connector1.Position.Y - game.BlockY )
self.rotation = vectorToAngle( game.BlockX - scene.Connector1.Position.X , game.BlockY - scene.Connector2.Position.Y )
self.positionY = game.BlockX +( scene.Connector1.Position.X - game.BlockX )/2
self.position.X = game.BirdY +( scene.Connector1.Position.Y - game.BlockY )/2
Elastic on the left:
Do all the same as the above but with scene.Connector2
In the above you make some anchor points which hold one side of each "bit" of elastic. You then attach the other side to the bird. Then set the rotation of the elastic. Then the width (really the length as you would think in the real world).
I wrote the above in no particular order, just as it came to me, also it's 02:15, so no promises that any of the above is in any way correct! ;-)
Also - "slingshot ropes" is what made me want to help... I did something like this the other day and I couldn't find anything to help me so I player with it all day till I got it right. It seemed to work, but once I did it I deleted it and carried on with my own game. It was just a distraction to save me from thinking about vector addition...
Thanks
p.s. I'm going around answering questions so that the people who actually know what they're doing will take a few minutes to answer mine! I'm totally stuck on a few things and it's driving me nuts!
No problem. Any chance you can upload your project somewhere? Also, all three are constrains - Sorry, forgot to mention that, but it was very late!