Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,088 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Calculate the future position of the ball #53167
08/23/05 15:45
08/23/05 15:45
Joined: Jul 2005
Posts: 12
V
vertice32 Offline OP
Newbie
vertice32  Offline OP
Newbie
V

Joined: Jul 2005
Posts: 12
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.

Re: Calculate the future position of the ball [Re: vertice32] #53168
08/23/05 16:09
08/23/05 16:09
Joined: Jul 2001
Posts: 1,269
Hopewell Jct, NY
Yulor Offline
Senior Developer
Yulor  Offline
Senior Developer

Joined: Jul 2001
Posts: 1,269
Hopewell Jct, NY
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.

Re: Calculate the future position of the ball [Re: Yulor] #53169
08/23/05 17:23
08/23/05 17:23
Joined: Jul 2005
Posts: 12
V
vertice32 Offline OP
Newbie
vertice32  Offline OP
Newbie
V

Joined: Jul 2005
Posts: 12
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);
}

Re: Calculate the future position of the ball [Re: vertice32] #53170
08/23/05 17:24
08/23/05 17:24
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Which version and edition do you have?
Depending on this, you could just use the physics engine.

Re: Calculate the future position of the ball [Re: fastlane69] #53171
08/23/05 17:29
08/23/05 17:29
Joined: Jul 2005
Posts: 12
V
vertice32 Offline OP
Newbie
vertice32  Offline OP
Newbie
V

Joined: Jul 2005
Posts: 12
I am using A6.22 pro.

Re: Calculate the future position of the ball [Re: vertice32] #53172
08/23/05 17:49
08/23/05 17:49
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
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!


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1