Mouse Clicking
22 posts • Page 1 of 1
Mouse Clicking
I have looked through Grady's stuff, but I cannot find out how to make a click do anything. Like in Versieon's Physics Scene for instance.
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Ok.... Do you want like a hinge controlled by a click or a box that can tell that it has been clicked like in this scene:
Author: Niffirg1
Title: Ragdoll Avalanche Ultimate
File Size: 15.22 kB
Rating:
I could Help with both.
If you want the simulation to know that the Mouse has gone into a certain postion then
Insert t what you need into the Bla's like the mouse position on the x axis or the y-axis or the reaction.
Hope this was of some help to you
Author: Niffirg1
Title: Ragdoll Avalanche Ultimate
File Size: 15.22 kB
Rating:
I could Help with both.
If you want the simulation to know that the Mouse has gone into a certain postion then
- Code: Select all
{(app.mousepos(0) >= Bla && app.mousepos(0) <= bla) && (app.mousepos(1) >= bla && app.mousepos(1) <= bla)} ? {Bla } : {bla}
Insert t what you need into the Bla's like the mouse position on the x axis or the y-axis or the reaction.
Hope this was of some help to you
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Mouse Clicking
Yes thankyou. Now, I might find this myself, but jsut incase, how does the x-y axis work in Algodoo? How do you know where is where(coordinate wise)
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Yes thankyou. Now, I might find this myself, but jsut incase, how does the x-y axis work in Algodoo? How do you know where is where(coordinate wise)
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Double post.
You know how grid's work right? [0, 0] is the center of the cartesian plane, [1, 0] is directly on the Y line, but to the left of the centre, [0, 1] is on the X line, but up 1. Hard to explain, but this is basically how it all works. [0, 0] is the very centre of gun
If you have done maths in school, this should be no problem at all
For future referance, pos(0) is the X axis, and pos(1) is the Y axis
You know how grid's work right? [0, 0] is the center of the cartesian plane, [1, 0] is directly on the Y line, but to the left of the centre, [0, 1] is on the X line, but up 1. Hard to explain, but this is basically how it all works. [0, 0] is the very centre of gun
If you have done maths in school, this should be no problem at all
For future referance, pos(0) is the X axis, and pos(1) is the Y axis
-
kilebantick - Posts: 1267
- Joined: Tue Sep 01, 2009 9:50 am
Re: Mouse Clicking
How i find it is by making a box that tells me the mouse pos(app.mousepos) and then writing my script of of those positions.
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Mouse Clicking
So pos is probably based on scene, and not onscreen?
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
True, it is based on the scene, so that your cordinates are always acurate no mater what you are viewing
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Mouse Clicking
Okay, that makes it loads simpler. In your physics scene, I was worried it was otherwise.
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Create a box and in the text script menu write
Sorry could not answer sooner i just got a puppy and it is my responsibility to lets say collect his presents
- Code: Select all
{"" + app.mousepos}
Sorry could not answer sooner i just got a puppy and it is my responsibility to lets say collect his presents
-
niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Mouse Clicking
niffirg1 wrote:Create a box and in the text script menu write
- Code: Select all
{"" + app.mousepos}
Sorry could not answer sooner i just got a puppy and it is my responsibility to lets say collect his presents
You forgot to tell him [b]where[/i] to put it.
You put it in the text script box.
-
standardtoaster - Posts: 606
- Joined: Mon Aug 31, 2009 7:57 pm
Re: Mouse Clicking
standardtoaster wrote:niffirg1 wrote:Create a box and in the text script menu write
- Code: Select all
{"" + app.mousepos}
Sorry could not answer sooner i just got a puppy and it is my responsibility to lets say collect his presents
You forgot to tell him [b]where[/i] to put it.
You put it in the text script box.
uhh... yes he did read his post
and niffirg, did your puppy make algo-doo? (sorry, i couldnt resist)
TheWinkits wrote:They both looks of cuking amazing
-
Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
Re: Mouse Clicking
if you create the code for a button,and then drag the button around, will it still be "clickable"
P.S. I am new here
P.S. I am new here
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: Mouse Clicking
nope. I wish that was possible. Wait, scratch that. If you had two boxs in two corners of the button that set THIER respective x and y cooridinates to a variable, then those variables were used as the coordinates, then it might work.
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Blazemann wrote:nope. I wish that was possible. Wait, scratch that. If you had two boxs in two corners of the button that set THIER respective x and y cooridinates to a variable, then those variables were used as the coordinates, then it might work.
what code would work to input the variables as the coordinates
...and that would only work for one button
What if you had a script that carry out an action when an object is selected?
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: Mouse Clicking
I don't know of any value for selected versus unselected, but there would be the problem then of multiple selections at once.(like fast forward and rewind at the same time)
-
Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Mouse Clicking
Blazemann wrote:I don't know of any value for selected versus unselected, but there would be the problem then of multiple selections at once.(like fast forward and rewind at the same time)
good point!
edit: maybe you could have a prevention code?
selected = fast-forward ? {selected = re-wind ? {} : {code to carry out}} : {}
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: Mouse Clicking
I brought up the topic of selected objects because i never could get the coordinate thing to work.
could somebody post a code for a square that is 2 by 2 meters, and in the center of the x,y coordinates
could somebody post a code for a square that is 2 by 2 meters, and in the center of the x,y coordinates
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: Mouse Clicking
If you look at my Simple Physics scenes, They have a self contained clickable button that can be moved anywhere and still funtion correctly, as for a toggle, the if statement is correct
This switches ff between 0 and 1.
As for a code for a button,
This would go in the bottom left corner, in a mouse controlled collider.
For 2m box, change the .5 to 2
- Code: Select all
{scene.my.ff == 1} ? {scene.my.ff = 0} : {scene.my.ff = 1}
This switches ff between 0 and 1.
As for a code for a button,
- Code: Select all
(e)=>{{(app.mousepos(0) >= e.pos(0)) && (app.mousepos(0) <= (e.pos(0) + 0.5)) && (app.mousepos(1) >= e.pos(1)) && (app.mousepos(1) <= (e.pos(1) + 0.5))} ? {What you want to do here} : {else}}
This would go in the bottom left corner, in a mouse controlled collider.
For 2m box, change the .5 to 2
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Mouse Clicking
thank you so much, versieon
i thought you were supposed to enter the code into the config, but you enlightened me to the truth
i used the click mechanism from your phun dvd player, I hope you don't mind
i thought you were supposed to enter the code into the config, but you enlightened me to the truth
i used the click mechanism from your phun dvd player, I hope you don't mind
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
Re: Mouse Clicking
Not at all, just cred me if you do!!
-
Versieon - Posts: 375
- Joined: Tue Sep 01, 2009 4:45 pm
Re: Mouse Clicking
Versieon wrote:Not at all, just cred me if you do!!
thx
**/\ /\
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
>( ' ; ' )<***<---------- cat
*((")("))
i'm right-side-up
uʍop-ǝpısdn ɯ,ı
http://www.sherv.net/flip.html
-
algadoodle123 - Posts: 66
- Joined: Tue Sep 08, 2009 6:04 pm
22 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest