Ball Physics
by Quentin Headen · in Torque Game Engine · 09/17/2007 (11:30 am) · 10 replies
Hello all. I just wanted to know if there is a way you can implement ball physics into Torque. I am talking about somthing like bowling ball physics. Please let me know.
Thanks :)
Thanks :)
About the author
Just your average programmer who tries to finish the projects he starts. :) I am currently focused on creating games with Torque engines. My website is http://phaseshiftsoftware.com
#2
09/18/2007 (11:21 am)
I made the ball as an Item, but it won't mount on the player. Static Shapes don't seem to mount on the player either by using Player.mountObject(%objA, %objB). What types of objects can mount onto a Player?
#3
:(
09/18/2007 (12:54 pm)
When I try to create a RigidShape from a RigidShapeDatablock, my game just closes. I don't know why this happens. Please help me.:(
#4
It is on my long list of TGE things to work on; Add a default MASS node if one is not already in the mesh. (Will try and look at it today if i get time..)
09/18/2007 (1:12 pm)
RigidShape object needs a MASS node. It is on my long list of TGE things to work on; Add a default MASS node if one is not already in the mesh. (Will try and look at it today if i get time..)
#5
09/18/2007 (1:16 pm)
So how can I add a RigidShape from RigidShapeData in TorqueScirpt without modding the engine itself?
#6
EDIT:
I have found the location of the MASS node have nothing to do with the RigidShape center of MASS, it may be located anyplace...
09/18/2007 (1:17 pm)
You will need to open the DTS shape file you are using for the RigidShapeData and add a MASS node.EDIT:
I have found the location of the MASS node have nothing to do with the RigidShape center of MASS, it may be located anyplace...
#7
P.S. The player I am using isn't somthing that I made. It's the orc player in the FPS starter kit. So don't think I didn't add the right node or something. :)
09/18/2007 (1:34 pm)
Thanks a lot Caylo, the ball shows up now. I am having some more trouble though. I can't seem to mount the bowling ball to my player. I have to be able to do that because this is a bowling games, so that entales the ball being in the players hand. Is there a way I can solve this?P.S. The player I am using isn't somthing that I made. It's the orc player in the FPS starter kit. So don't think I didn't add the right node or something. :)
#9
It might help to think of the ball as two seperate objects: one that is mounted to the player's hand, and another that is rolling/interacting with the environment. The ball that is mounted to the player's hand can be a staticShape. When the player "releases" the ball, you can delete or hide the staticShape. At the same time, you can spawn a new rigidShape ball in the exact position of the staticShape ball, and then use the setVelocity function to roll it down the lane.
This is how dropping weapons works. The weapon in hand is a shapeBaseImage. The weapon on the ground is an item.
09/18/2007 (2:05 pm)
In reference to mounting the ball: make sure there is a mount node on both the player's hand and on the ball. It might help to think of the ball as two seperate objects: one that is mounted to the player's hand, and another that is rolling/interacting with the environment. The ball that is mounted to the player's hand can be a staticShape. When the player "releases" the ball, you can delete or hide the staticShape. At the same time, you can spawn a new rigidShape ball in the exact position of the staticShape ball, and then use the setVelocity function to roll it down the lane.
This is how dropping weapons works. The weapon in hand is a shapeBaseImage. The weapon on the ground is an item.
#10
09/18/2007 (2:20 pm)
Thanks a lot guys. I now have enough knoledge to get this working. Please keep checking this post, because when I get it going. I will post some pictures. :)
Torque Owner Frank Korf
Start by using a RigidShape. The ball will not be perfectly round, but it will be quite convincing. 99 times out of 100, this will be all you need.
If the ball is the central piece in your game, and you need the roll to be perfect, you will have a bit of work ahead of you. I created a custom class, and implemented custom collision detection and response routines. While I cannot share the actual code, I would be happy to point you in the right direction.
Again, start with RigidShape. Unless you are making a marble blast clone, this will probably be all you need.