Game Development Community

How to Create a Ball, with Physics

by FxGames · in Torque Game Engine · 11/09/2005 (4:52 am) · 10 replies

Hi guys,

Its my first post.. so.. dont blame me! :P

Well.. im trying to make a test with Torque, creating a ball...
I already create the .DTS, but the collision its a little SQUARE.. hehe
But, im trying to put this ball on my game, and its doesnt ROLL... the problem is the collision box?

And... what properties exists to me put in this ball? Like MASS, GRAVITY, etc..
And where can i found those properties... in the source code?

Someone can explain me more, on how to look those properties, or class methods.. but via scripting?

Thanks

RWRZ

#1
11/09/2005 (6:22 am)
Hmm...

Thanks man! :D But...

torque doesnt have its own Physics? i need to change something like this resource?


And about gravity?
Im making a game, wich a ball never stops... and it will collide inside a CUBE, for ex.. and never stops... something like space people playing football in the space. ;P

Then, my ball doesnt have friction, and no gravity in the ambient... how can i make this?

Thanks

RW
#2
11/10/2005 (7:41 am)
Hi,

I'm just learning my way around here as well, so I don't know how much use this will be.

There appears to be two datablocks where you can set the attributes you mention.

1)ShapeBaseData has mass,density and drag properties.
2)ItemData has friction and gravityMod properties.

As ItemData is a subclass of shapeBaseData, I assume you can set all of them there. I think you can set the gravity modifier to a negative value which will make you float. But as to where you set the overall gravity or friction for the game I don't have a clue (yet).

Dave.
#3
11/10/2005 (8:22 am)
Thanks Dave...

Im looking for something new for me... Physical Zones...
I already added one on my mission... And modify gravity to 0.. then, my player floats!
Butt...

The physical zone, doesnt make effect in my ball... my ball still static on the physical zone.. hehe
If i stand it up, it fall to the ground... =/

Well..
I dont know if im going to the correct path... i need a ball that kicks inside a room... and never stop... like a .. hmm.. PONG game? DXBall ? Something like this... a ball that collide with walls, and never stop until get th GOAL point...

If someone can give me LIGHT! i will appreciate...

thanks

RW
#4
11/10/2005 (9:23 am)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5024 This may be what you might want to look at assuming this isn't a networked multiplayer game you are working on.

Edit it says an update with multiplayer support but I have no idea if that works.
#5
11/10/2005 (9:26 am)
Did you set the mass of the ball in the rigidbody datablock to 0 ?
#6
11/10/2005 (9:30 am)
Thanks Michael... im looking for this ODEItem...
And its a multiplayer game... in the ODEItem docs, says tat multiplayer is functional.. lets see.. hehe

And david.. i will look this .. but im not using Rigidbody.. im using shapebase...

Im looking for the Script Docs too... with dump functions... maybe i can have a light for what im searching for...
cuz i dnt know i really need a physics engine for this game...
its somehthings like DXBall or PONG game...

thanks

RW
#7
11/10/2005 (9:48 am)
Typically when we want custom physics in a project, we make a new subclass of (usually) ShapeBase, and add our own custom physics response code to its processTick. See WheeledVehicle and Player for examples.
#8
11/10/2005 (8:54 pm)
Since no one else said it - i will. Look at Marble-Blast. I don't think the source is available but it was built out of starter.fps with the Torque engine as I recall. That should at least give you some idea of what is possible in Torque, even if it doesn't solve the how.

A lot of the older documentation uses marble-blast as an example too, so maybe you can pick up some hints. Torque Docs

I'm new here too, but so far most ppl here don't bite.
Good-Luck! :-)
#9
11/10/2005 (10:03 pm)
Incidentally, for MarbleBlast, all the marble physics live in a Marble object that derives from ShapeBase. For MBU we did a little deeper rewrite but still the same idea.
#10
11/11/2005 (2:40 am)
Hmm.. ok!

Im trying to solve this right now...
The problem is: "I dont know how to program physics" ... But, i just need time to understand the code...

Thanks again guys.. i will be posting here my "know how" soon! :P

cya!

RW