How do I ball trajectory prediction

Get help using Construct 2

Post » Sun Oct 11, 2015 1:01 pm

Has anyone successfully created a physics based ball trajectory prediction tracer? the following is about the best I can come up with but it's not really good enough, for obvious reasons.

https://www.dropbox.com/s/9dh4fyv8jq2fo9x/ball-trajectory.capx?dl=0
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Sun Oct 11, 2015 1:50 pm

Prediction, like anticipate the ball movement? Your example is just a trail. You can spawn a "motion blur" instead.
this is another approach https://dl.dropboxusercontent.com/u/139 ... ry_v2.capx
Last edited by Cipriux on Tue Oct 13, 2015 9:31 am, edited 1 time in total.
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Sun Oct 11, 2015 2:05 pm

This version is even better https://dl.dropboxusercontent.com/u/139 ... ry_v3.capx
It only works if only one ball is at the screen, those 2 variables ball_astX and ball_lastY are global, if many balls are on screen, one will overwrite the other value. Instead you can create instead of global variables, instance variables, and for the square trail assign an instance variable having the UID of the ball that create it :) (parent)
Last edited by Cipriux on Tue Oct 13, 2015 9:32 am, edited 1 time in total.
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Sun Oct 11, 2015 2:11 pm

I was a little un-descriptive in my first post with the word tracer, what I'm after is a way to create a path showing the trajectory the ball will travel before it's shot including after hitting objects kinda like in peggle. That's a great tracer effect though, thanks for sharing will be using that.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Post » Sun Oct 11, 2015 2:14 pm

AHA, I see
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Sun Oct 11, 2015 2:15 pm

I will try to make you the prediction also
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Sun Oct 11, 2015 5:20 pm

I tried creating the prediction by giving a biger impulse ti increase speed, but all the variables need to be changed to create the same trajectory, since it all depends of time, and C2 precision, everything goes wrong. Since trajectory depends on gravity and time, if you want to make a game without gravity involved it can make good prediction.
I aso tried with setting the timescale, but no luck https://dl.dropboxusercontent.com/u/139 ... ry_v4.capx

P.S. change the global variable Gravity from 10 to 0 to see that prediction is much better.
Last edited by Cipriux on Tue Oct 13, 2015 9:32 am, edited 1 time in total.
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Sun Oct 11, 2015 5:59 pm

There's an example here that draws the path of the object.
parabola-tracjectory-tracing-with-physics-box2d_p640838?#p640838

It doesn't do collisions though.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sun Oct 11, 2015 6:22 pm

@R0J0hound Cool post. Thanks :D
B
79
S
21
G
23
Posts: 513
Reputation: 18,648

Post » Mon Oct 12, 2015 5:08 am

Thanks guys unfortunately at this time my maths skills are terrible :) you obviously know what your doing and if collisions are difficult for you to figure out, it would be far beyond me. I was attempting to create a Peggle clone, have learn't tons up to this point but I think a game like this really needs the ball prediction with collisions. I'll have a think and in the mean-time start some more experiments, love tinkering around with Construct. I find it much easier to learn by trying to re-create a game I already know and love.
Have retro games for sale? Buy & Sell Retro Games UK
B
9
S
2
Posts: 68
Reputation: 768

Next

Return to How do I....?

Who is online

Users browsing this forum: Bootfit, Huemerson, jorgmaquoi, RobertMKD and 6 guests