Parabolic movement between 2 points

Get help using Construct 2

Post » Tue Jan 14, 2014 9:03 pm

I have a fixed startpoint A at x,y and a dynamic destination at B x,y, by selection of mouse/touch.

I am looking for an approach other then physics to make an object follow a parabolic leaps from a to b in a isometric like scenarion.

It does not have to be precise, or a perfect arch, its for a bit of eye candy so it needs to be light and perhaaps lerped or something.

I'd like to do this without plugins.

Right now I use a combination of a fixed 270 ddegree impule combined with an angluard impulse with some distance math. It works semi, though, its not perfect, far from.

Another approach I used was with a bullet and some gravity, but I cant make out the formula needed to have it target switch to another B point.

the best so far was with the physics ...but its also in accurate, if you have a better suggestion then the following:

targetx,y is start point, countries x,y is point b


If you see room for improvement or have a better approach, I'd be gratefull :)



In short: how do I make an arch like effect between 2 points on an x,y grid.
lennaert2014-01-14 21:04:14
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Tue Jan 14, 2014 9:12 pm

If it's just for eye-candy I would create the arc with the custom movement behaviour.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jan 14, 2014 9:16 pm

[[email protected]] If it's just for eye-candy I would create the arc with the custom movement behaviour.[/QUOTE]

I got as far as to adding it earlier ... checking the options .. testing a few, .. and having some similair issues as to the bullet with grav.

I can worj out 1 nice arch with some trial and error, but when I aim for another location, say the opposite side, ... then it goes awry.

Suggestions as to approach with custom movement?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Tue Jan 14, 2014 10:02 pm

If you can move an object from one point to another then all that's left is to move up and down as well.

With this formula as a base for the parabolic motion:
1-4*(x-0.5)^2
Here's a capx:
https://www.dropbox.com/s/cpzg482vpmatb ... .capx?dl=1
/examples21/leaper.capx
Last edited by R0J0hound on Mon May 15, 2017 8:15 pm, edited 1 time in total.
B
92
S
32
G
110
Posts: 5,298
Reputation: 71,507

Post » Tue Jan 14, 2014 10:54 pm

[[email protected]] If you can move an object from one point to another then all that's left is to move up and down as well.

With this formula as a base for the parabolic motion:
1-4*(x-0.5)^2
Here's a capx:
https://dl.dropboxusercontent.com/u/5426011/examples21/leaper.capx[/QUOTE]


Sweeeeet :D

Thanks a lot R0J0hound !!!
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sun Jul 30, 2017 5:26 am

R0J0hound wrote:If you can move an object from one point to another then all that's left is to move up and down as well.

With this formula as a base for the parabolic motion:
1-4*(x-0.5)^2
Here's a capx:
https://www.dropbox.com/s/cpzg482vpmatb ... .capx?dl=1
/examples21/leaper.capx


Thank you ROJOhound for sharing your knowledge. This formula and its application in the Capx is priceless. Truly grateful. In the past I have spent over a hundred hours looking for a parabola formula while I was learning to use "scratch" and later "appInventor". I found a more complicated version of what you show here and was dreading finding a way to implement it in Construct. Your approach is concise and flawless. Your post not only helps me save time (which is precious) but has me smiling at the possibilities and ease of using parabolic motion under many more scenarios and playing with the parameters or variables that you provided.
B
18
S
4
G
1
Posts: 1
Reputation: 1,559

Post » Sun Jul 30, 2017 11:13 am

@R0J0hound - this is super cool! Such an elegant solution to a complex problem, and something I've wrestled with multiple times, usually ending up with a bunch of fudges and magic numbers to get it approximating to what I need. Adding my vote of thanks for sharing.

Out of interest, how could you adapt this so that upon the sprite reaching (xend,yend) it continues along the parabola?
B
20
S
8
G
3
Posts: 460
Reputation: 4,059

Post » Sun Jul 30, 2017 1:13 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jul 30, 2017 2:40 pm

@99Instances2Go

Sorry, I'm stuck on r244 for the time being so can't check that out. I'll check it once 245 goes stable.
B
20
S
8
G
3
Posts: 460
Reputation: 4,059

Post » Sun Jul 30, 2017 11:35 pm

@mekonbekon
Remove the t<1 condition and change the "set t" expression to self.t+dt/leaptime.
B
92
S
32
G
110
Posts: 5,298
Reputation: 71,507

Next

Return to How do I....?

Who is online

Users browsing this forum: JackTYGA, zill and 35 guests