Calculate the future position of the ball

Posted By: vertice32

Calculate the future position of the ball - 08/23/05 15:45

Please forgive my English and my physics knowledge.
Although have searched in the forum, still not found solution for the following
problem: I intend to calculate with precision which will be the future position that a ball reaches, applying one force and with one determined friction. I know that distance = speed x time, but how should I implement this formula? Should I use phent_getVelocity()? But with the force = x, how do I know where the ball will go to stop, and save that information in a vector?
Thanks.
Posted By: Yulor

Re: Calculate the future position of the ball - 08/23/05 16:09

What exactly are you trying to do with the information on where the ball is? In the past what i've always done is use movement vectors that I use in a move command (c_move or ent_move) before I calculate the movement with the move command to do any type of calculation (be in a camera position, or anything else).

but I can help you with any physics questions if you need.
Posted By: vertice32

Re: Calculate the future position of the ball - 08/23/05 17:23

Thank you for trying to help me Yulor.
I am trying to develop a sport game, type soccer, and to implement for example a corner kick, i need to know the information where the ball will go to stop, when applying one force and friction, so that way i will indicate previously to the other player or players where they must move in order to run and shoot the ball to the goal.

The code for the ball:

PHENT_SETTYPE(MY,PH_RIGID,PH_SPHERE);
PHENT_SETMASS(MY,0.2,PH_SPHERE);
PHENT_SETFRICTION(MY,75);
PHENT_SETELASTICITY(MY,75,25);
PHENT_SETDAMPING(MY,50,75);
PH_SETGRAVITY(VECTOR(ARCO,0,-386));

FUNCTION KICK_BALL()
{
VEC_SET(TEMP, NULLVECTOR);
vec_set (temp.X, vector (POWER_KICK,0,PH_Z));
PHENT_ADDCENTRALFORCE (ball, temp);
}
Posted By: fastlane69

Re: Calculate the future position of the ball - 08/23/05 17:24

Which version and edition do you have?
Depending on this, you could just use the physics engine.
Posted By: vertice32

Re: Calculate the future position of the ball - 08/23/05 17:29

I am using A6.22 pro.
Posted By: fastlane69

Re: Calculate the future position of the ball - 08/23/05 17:49

Then your first job is to upgrade to the latest version of 3DGS and read up on the Physics Engine.

Your request is trivial using the Physics Engine.
Problem solved! Good Luck!
© 2024 lite-C Forums