Game Development Community

Ball simulation

by Fabio Daniel "Sagaz" · in Torque Game Engine · 03/17/2006 (8:12 pm) · 7 replies

Hi there!


I'm developing a soccer-kind of game in TGE, and I was searching weeks in the database for some explanation about how to simulate the ball: make it bounce with the ground, the players... act as a "free" object in the real world. As an sport-kind game, it's essencial to make the game, and I haven't found anything clear or useful enough to try. I'm not a programmer and I use TGE for almost a year from now, but I have programmers and all of us aren't doing anything useful to the game. What are we doing wrong? Can anyone explain us how to do so? Best regards for all, and thanks for convenience.

#1
03/21/2006 (11:19 pm)
I don't know if you've already checked this out, but RigidShape class It's a basic object type with rigid body physics. You should be able to use it to get at least a basic prototype going, though chances are you'd want to eventually refine the physics exclusively for your game.

Best of luck with your game.
#2
03/22/2006 (8:42 am)
Cool! Thanks a lot Delirium! I'll just check this now, and I'll post possible results as sonn as I can. Thanks!
#3
03/22/2006 (9:31 am)
The Item class can also be used for a simple colliding/bouncing ball very easily, I'd start there if I were you.

Ian
#4
03/22/2006 (11:54 am)
Just reporting:

I've tried the resource Delirium posted here..... AWESOME! Thanks a lot you and the Man of ice (resource's creator)! Just as he said, it's unbelievable that TGE doesn't have it as a standard! As soon as I can I'll be posting pictures and a demo of the game for you all. Thanks again! (so you see how important it was for us!)
#5
03/22/2006 (1:12 pm)
Anytime ;-)

And glad you got it working. Post/send some movie or screenshot, and I'll be happy
#6
03/22/2006 (1:56 pm)
Thomas, I've found in your resource's thread that you've changed a little portion of the script, basicly those variables:

%pos = getWords(%trans, 0, 2); into %pos = getWords(%trans, 4, 6);

When I try this a single collision with the ball throws it far and far away... so I tried to do a reduction in the final force apllied:

%col.applyImpulse(%pos,%vec); into %col.applyImpulse(%pos,%vec/10);

and then, or an even less number than 10, the ball remains static (so small force to move it). What means those 0 and 2 in the change you made?

PS: Thanks for the resource again! Awesome! And definetively, WHY TGE DOESN'T USE THIS AS AN STANDARD?
#7
03/22/2006 (5:12 pm)
I believe the updated 1.4.2 will have it standard.