Constrain to Circle while dragging?
Hey yo, I have seen fire maple's constrain to circle project, and what I want to do is similar to that, however I want my object im dragging to stay constrained to the outskirts of the circle. So if i am dragging my object I want it to remain on this black line:
http://www.medwaycropcircle.co.uk/The Circle ONEsmaller.jpg
Is there any way to do this? because I noticed that when dragging, objects tend to just move through other objects even if they are set to collide and not movable. Constrains override collisions. Im wondering if there is a workaround.
http://www.medwaycropcircle.co.uk/The Circle ONEsmaller.jpg
Is there any way to do this? because I noticed that when dragging, objects tend to just move through other objects even if they are set to collide and not movable. Constrains override collisions. Im wondering if there is a workaround.
Comments
Make an attribute (of type real) called "mouseAngle"
Rule: When touch is pressed
---- Constrain Attribute: game.mouseAngle To: vectorToAngle( game.Mouse.Position.X -240, game.Mouse.Position.Y -160)
Then have the following constrains _outside_ of the above rule:
Constrain Attribute: self.Position.X To: 240+75*cos( game.mouseAngle )
Constrain Attribute: self.Position.Y To: 160+75*sin( game.mouseAngle )
Constrain Attribute: self.Rotation To: game.mouseAngle
Thats it! You can change the x,y coordinates and the radius to suit your needs
Hope this helps!
RThurman
RThurman
Brilliant stuff !! (re: draggable circle code)
@Tynan .... It is brilliant! But it's not my idea. I lifted it off of someone else. Personally I have not had an original thought. All my posts come from cobbling together others' stuff. There have been some truly great posts in this forum. And the previous forum was full of great pearls of wisdom from the legends of GameSalad.
RThurman
"It is brilliant! But it's not my idea. I lifted it off of someone else. Personally I have not had an original thought"
You disgust me, you shameless thief . . . .
[goes off to work on his game largely cobbled together from stolen ideas]
But I am appreciative of this great forum and the shamelessly helpful people who frequent it.
RThurman