Game Development Community

Gravity and objects

by Chris Schletter · in Torque Game Engine Advanced · 10/17/2005 (11:29 am) · 3 replies

I recently updated my TSE codebase with a derived version of the gravity mod. Works well enough, and allows me to play with gravity in new and interesting ways.

However, I really need to work towards having zones of gravity that pull towards them. So really the opposite of the PhysicalZone. What would be the best way to implement them in TSE? Best bet to create something akin to the PhysicalZone that can act as an attractor/repulsor?

Or would it be better to embed this in the vehicle/object source when doing the physics, i.e. do a search for nearby objects and see if they have an attraction or replusing force and then apply it when doing the physics for the vehicles (obviously force would be based on a vector and distance from the object.)

Any thoughts?

#1
03/10/2006 (4:20 pm)
Bump.. any thoughts on how to accomplish this with the default Torque physics system?
#2
03/11/2006 (7:33 am)
99.9% of Torque (stock) physics are implemented on each object (in the object's class implementation), instead of having "world" physics. The primary reason behind this strategy is (as is true in most reasons for TGE/TSE) networking, since you need direct control over everything going on to fine tune performance for each object.

For this particular scenario, I would implement a SceneObject (I think, would have to check for the absolute best class to use) that is simply a "gravity point source", and keep track of every one of these objects in some form of SimSet.

I would then, for each of my game objects that need to be effected by this type of force, implement the physics in that object class'es ::processTick() chain..either directly there for the more simplistic classes, or in the appropriate method called by ::processTick() in the case of more complex objects (Player comes to mind).
#3
03/11/2006 (6:22 pm)
Stephen,

Ok, I'll have to play around with that and see what happens. Thanks for the tip... if you come up with any great ideas concerning it, do let me know!