Page 1 of 1

tutorial for VERY EASY MOUSE POINTER

PostPosted: Thu Jan 06, 2011 4:56 pm
by jessebax129
Hi i'm jesse and if you've got a problem with the "complicated" math scenes of kilinich (not meant bad for you kilinich :angel: )
one scene is a mouse pointer like his servo motors, i don't understand s*** about whats the script says :crazy:

i came up with an idea myself to make a mouse follower that needs only 2 variables
the following script is very easy, i will first explain it to you:
if you make a "aiming hinge with box" (so like the part on a gun that twists when aiming).
it's important it lays FLAT on the ground, so it's not higher than it's wide, then make a laser (only collideset B) and make a small box (also collideset B), make the laser point at the box and set it close to it, now select them both and copy it with "CTRL".
if you've done right you now have 2 lasers and 2 boxes
select 1 laser and the box it's pointing at and put them ON the aiming box, NOT IN THE MIDDLE BUT IN THE CORNER... now take the second laser and box and do the same

example: but laser+box in the top left corner of that box and the other laser+box in the DOWN LEFT CORNER
if you dont understand check the scene, the lasers and boxes in mean are BLUE [0,1,0,1],
now fixate both boxes to the aiming box.
then: select the lasers and type in the onlaserhit:
Code: Select all
(e)=>{e.laser.distance = (((e.pos(0) - app.mousepos(0)) ^ 2) + ((e.pos(1) - app.mmousepos(1)) ^ 2)) ^ 0.5}

that is the code for distance calculation (using the law on pytagoras: a^2+b^2=c^2)
now, put in the console:
Code: Select all
scene.my.distance1 = 0 and scene.my.distance2 =0

then, put in one laser next to the pytagoras code using ; the following:
Code: Select all
scene.my.distance1 = e.laser.distance

put in the OTHER laser the same but now we use the second part of the array, so it will be number2. it looks like this:
Code: Select all
scene.my.distance1 = e.laser.distance

a COMPLETE CODE of 1 la2er (caution: the 2 lasers are almost but NOT the same):
Code: Select all
(e)=>{e.laser.distance = (((e.pos(0) - app.mousepos(0)) ^ 2) + ((e.pos(1) - app.mmousepos(1)) ^ 2)) ^ 0.5;scene.my.distance1 = e.laser.distance}

now you're almost done, the only thing you have to do is make a hinge
make a hinge at the rotation box, set motor TRUE and torque to +inf
then, set the motorspeed IN THE SCRPIT MENU OF THE HINGE to:
Code: Select all
{(scene.my.distance1 - scene.my.distance2)* "whatever you want, it will be faster but more unstable, recommended is between 10 and 20"

now you are done, check this scene of me and if it's practically the same as you made... then you are a hero and have succes

PLZ COMMENT AND RATE, any questions? email me at jesse_bax@live.nl. nederlands? email gwn met nederlands taal haha

Rating: rated 5
Filesize: 6.56 kB
Comments: 0
Ratings: 1
download

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Mon Feb 07, 2011 12:22 pm
by FuzzyLogicBrain
What's it supposed to do? Doin nothing but turn In circles

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Thu Apr 28, 2011 5:49 pm
by FuzzyLogicBrain
this is no help at all! it DOES,,.. NOT,,.. WORK!!!!

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Thu Apr 28, 2011 6:34 pm
by jessebax129
yes it works... do not say it doesn't because i made it myself

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Thu Apr 28, 2011 10:16 pm
by FuzzyLogicBrain
hmmph! thats scant proof

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Thu Apr 28, 2011 11:40 pm
by Someone Else
Rating: rated 6.2
Filesize: 9.9 kB
Comments: 7
Ratings: 4
download

I DID NOT MAKE THIS!!!!!

Much, much better mouse pointer.
Heck, I'd go so far as to say that it's infinitely better.

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Fri Apr 29, 2011 5:26 pm
by FuzzyLogicBrain
extreemly simple! woooooww! not a single varible to behold! but it seems to glitch when you put the mouse to close to the circles

Re: tutorial for VERY EASY MOUSE POINTER

PostPosted: Fri Apr 29, 2011 8:55 pm
by Someone Else
Yeah... if I could comprehend the code, I might be able to fix that. Or, maybe I'll try making my own code.

At the moment, however, the only thing to do is make the thing smaller (it scales very nicely) and not make it clear where it is. That actually works very well. As TC42 demonstrated in the RPG game thing. Which I might be able to improve upon now that I mostly understand the K-Menu.

Generally speaking, if you can't see where the circle is, then it's difficult (but not impossible) to make it fail like that.