Avoid Collision
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Avoid Collision
I have two draggable objects. I want both the objects to move as I drag them but I don't want them to collide or get overlap. Also how is it possible to drag them inside another object limiting their path...?
For eg, I want to Drag two square inside a Circle but I don't want both the square to collide or to overlap. Also the path of the squares should be limited inside the circle.
For eg, I want to Drag two square inside a Circle but I don't want both the square to collide or to overlap. Also the path of the squares should be limited inside the circle.
Re: Avoid Collision
Check out the demo of Animation Engine.. Malte has pretty much covered everything in there and made a pretty simple API to use and will save you countless time units spent figuring it out yourself.. But that being said, take a look at the is within operator, the location property (this will be the center point of the object so you can use it to keep your objects on a path which you might sent using one of the draw tools) and the move command.. Now each of those has a list of "see also" that you should check out.. After learning those commands you will still need to write your math and anything else required to do what you need it to do (you can see why I just recommend Animation Engine )
Re: Avoid Collision
I have gone through the manual of Animation engine but it only says about detecting collision. How to stop collision between two objects. Please send me the link if you have any. Thanks for the reply.
Re: Avoid Collision
Can you send me the link of that demo by Malte...?
Re: Avoid Collision
From reading your other posts, you already have it..
Re: Avoid Collision
I tried to use "is within" operator but it is showing the error "Operators is: right operand of within is not a rectangle near 140"
This my script
Is it ok?
This my script
Code: Select all
on mouseDown
grab me
point "248, 215" is within 140, 108, 356, 322
end mouseDown
-
- Posts: 49
- Joined: Sat Jun 16, 2012 7:57 pm
- Location: City of God Lug
Re: Avoid Collision
Hi,
Sorry to be harsh, but RTFM! It will require less time then posting here and you will learn a lot!
The Dictionary example for within is:
Do you notice anything?
HTH
Sorry to be harsh, but RTFM! It will require less time then posting here and you will learn a lot!
The Dictionary example for within is:
Code: Select all
"22,33" is within "22,17,150,200"
HTH
Best regards,
Didier
Didier
Re: Avoid Collision
Already tried that. But it gives an error" bad command"
-
- Posts: 49
- Joined: Sat Jun 16, 2012 7:57 pm
- Location: City of God Lug
Re: Avoid Collision
Really? Are you sure you *exactly* tried that?
If I type:
in the message box, LC returns true. I copied and pasted from your post, just added the quotes.
HTH
If I type:
Code: Select all
answer ("248, 215" is within "140, 108, 356, 322")
HTH
Best regards,
Didier
Didier
Re: Avoid Collision
Hi Surbhit29,
And that does not make any sense and is in fact a "bad command".
Do yourself a favour and check the basics of Livecode with the help of these stacks:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus
Because you are using it inside of your "mousedown" handler without any "put" or "get" or "answer" or whatever!Surbhit29 wrote:Already tried that. But it gives an error" bad command"
And that does not make any sense and is in fact a "bad command".
Do yourself a favour and check the basics of Livecode with the help of these stacks:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus