View Full Version : Animation Ball soccer natural gravity
31-01-2010, 02:15 AM
hi to all
I have a question for my football games, so I want to do an animation of the ball with natural gravity , I try with TGLMovementPath and TGLPathNode, but the animation is not natural.
Here is a video that I created with After affect, he show the animation that I want to do.
thank you to all
Please answer me
31-01-2010, 08:24 AM
Think of the ball as a big sphere particle. You have position and movement vectors (3D-vector is x,y,z coordinates). Each game tick ball's position vector is increased by its movement vector, and movement vector's Y-coordinate is decreased by gravity. When ball hits ground level, position vector is moved on top of ground, movement vector is scaled down by.. say multiplying Y with 0.3 (so next jump is smaller than last, in football much smaller) and Y is turned negative (this is the bounce effect).
But when we take grass into account we know that certain point ball won't bounce up anymore but instead starts rolling. You can by testing see by maybe "if movement vector's Y is < 0.2 then movement vector's Y = 0.
if KickKeyPressed then begin
// feel free to change constant fitting, this effects angle that
// ball flies upwards
if posY-BallRadius<groundlevel then begin
// hits ground
if moveY<-0.1 then // if speed 0.1 is lowest bounce after rolling starts
moveY:=-moveY*0.3 // bounce up
moveY:=0; // start rolling
moveX:=moveX*0.993; // Again feel free to experiment with slow-down constants
31-01-2010, 06:03 PM
hi User137 thank you ,
you can give me this exemple ,with project delphi
please :( :(
31-01-2010, 10:21 PM
I don't have GLScene at all so i won't be able to test this thing for you ;)
01-02-2010, 02:57 PM
Try it yourself and learn!
No offense, but If you keep asking others to do the work for you, you may need to consider taking a step back and make pong first (like most of us did). :yes:
01-02-2010, 06:16 PM
i have not interstand the code source then i can try it my self :(
01-02-2010, 09:19 PM
No offence as well here, but maybe game development is a little too hard for you yet? Try developing some simple apps and moving further, instead of hopping into the deep water.
Powered by vBulletin® Version 4.1.10 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.