Object following the path

Basically my question is in this 1.

To be clearer I want the object,which is a ball in my case, to follow one of the paths after checking rec attribute.

If rec is greater than 80 it follows path one (green one in the picture), if rec is lower than 80 and greater than 60 it follows yellow path and if it’s lower than 60 the dark red path.

Edit: Here’s my current working file so you can see my current problem. Hit the ball with A with first player, and X with second player.

Edit 2: There was a problem with my upload, I accidentaly posted wrong link. Now it’s OK

Perhaps understand this script and add some if() to it

Judging from your picture it looks like you are creating a physics based ball game. The above link from RetepTrun seems pretty helpful.

I must admit your question is little difficult to follow but taking a stab at what I think you want to do. You may want:

  • Use the built in physics engine
  • Fire the ball at a given tradjectory dependent on the position of the rect (bat?).
  • So lower the bat, steeper the angle vs vice versa (think thats how volley ball works)

I suggest this because we not really sure what you mean by follow a path. How did you define this “path”.

PS I think it is unfortunate that you’ve been downvoted as it looks like you are putting genuine effort into this.

How are you going to define this path? You going to have to create a parabollic curve that is a physics representation of what should happen to the ball. So how are you going to create this path yet alone follow it?

I can understand and I would have expected you not to want the standard behaviour on collision with a players hands. So on collision with the player you can set the trajectory to where you want it to go.

You have two choices really in all of this.

Use the existing physics engine, tweaking it to your needs or create a new one. Seems for what you are trying to do I would use the existing one.