Dragging an object and let it go with the velocity before released
Creator97
Member Posts: 140
Ok so my question is simple and what I want to do kind of works in my project but so weird that the object sometimes goes in the wrong direction when I let it go.
So I have an actor what I can drag around on the x axis with an offset (I can grab the actor where I want without having to deal with the problem that it constrains to the Mouse Position when I touch it.) and now when I don't press it anymore I want that it keeps moving with the velocity before I released it in the direction I dragged it.
Answers
Constrain Liner Velocity X to 30*( game.Mouse.Position.X - self.Position.X )
With offset ("O"):
Change O to mouse x - self x
Constrain Liner Velocity x to 30 *(mouse x - self x) -30 * O
(!@#$% you did understand me wrong. You thought that I want to keep it constraining to my mouse position after I released it? I want to let it move freely after that.)
What I want to achieve
Actor A:
When touch is pressed it constrains to my mouse position (with the offset) on the x axis. Now I start dragging it with a speed 'z' and then I release the object, so touch isn't pressed anymore it's now released. Now I want that the object keeps moving with the 'z' speed on the x axis in the direction I dragged it.
Did you try the suggested code ?
of course and it keeps constraining to the mouse position even if touch is released.
So you didn't understand me wrong?
Can you share a quick screenshot of your rule ?
of my rule that didn't work or of the rule I copied from your post?
The rule I suggested.
ok here is it.
https://www.dropbox.com/s/ni0gppxrpjq1fxd/GS.tiff?dl=0
Your rule (in the linked image) is nothing like what I suggested ! I have one change attribute and one constrain, your rule has one change attribute and three constrain attributes.
Give my suggested code a quick try, it will take less than a minute to try and it really does work !
it s exactly what you suggested it was just added to my old code because I thought I still need that basic stuff and you're just adding the "releasing part"
so in fact your code does works great when included in a touch is pressed rule. So where does that 30 come from?
and yeah quote your own second post that I can click 'yes' after did that answer your question because i clicked already no...
From the world of numbers
Higher values = tighter tracking
Lower values = looser tracking
When a Lady 15 and a Gentleman 15 like each other a lot they become really close and have what's called "addition" and that's where 30's come from.
Follow us: Twitter - Website