Creating a "Line"
DrGlickert
Member Posts: 1,135
I'm super confused right now on something that I believe to be a simple fix...
Imaging a fishing line; so I have 3 actors: A "rod", a "hook" and a "line"
I want the player to tap and the "hook" and "line" are cast out, the "rod" stays stationary (it is a hard-position)
I've been watching the Cookbook "Create a Line" video a number of times and I'm getting so confused...
I want the actor to change widths based on the way the line goes out (thus, it gets longer the farther away the "hook" goes) and when it's reeled in the line gets shorter and shorter.
I'm super confused with variables here...can someone help please?
Imaging a fishing line; so I have 3 actors: A "rod", a "hook" and a "line"
I want the player to tap and the "hook" and "line" are cast out, the "rod" stays stationary (it is a hard-position)
I've been watching the Cookbook "Create a Line" video a number of times and I'm getting so confused...
I want the actor to change widths based on the way the line goes out (thus, it gets longer the farther away the "hook" goes) and when it's reeled in the line gets shorter and shorter.
I'm super confused with variables here...can someone help please?
Comments
I have the line changing width's correctly. However, I've got it spawning at a fixed point on the scene.
I'm assuming that by using two Constrain Attributes I can achieve what it is that I want;
Constrain self.position.X to
Constrain self.position.Y to
What do I put in there?
Basically I'm asking how to maintain a point directly between two points where one is moving and one is stationary...
SO; how do I find the constant middle point between two points where one is moving...
Then you will need to constantly update the line actor in four ways:
Constrain Attribute: self.width To: magnitude( game.A1X - game.A2X , game.A1Y - game.A2Y )
Constrain Attribute: self.rotation To: vectorToAngle( game.A1X - game.A2X , game.A1Y - game.A2Y )
Constrain Attribute: self.Position.X To: game.A1X +( game.A2X - game.A1X )/2
Constrain Attribute: self.Position.Y To: game.A1Y +( game.A2Y - game.A1Y )/2
That should do it!
Its kind of a neat effect. So I decided to put it into Stormy's thread of useful equations.
Can you kind enough to share your file? or the link for Cookbook "Create a Line" video ?
Many thanks.