-1

My boss gave me this source code and let me add rigid body physics simulate support. Basically this source code simulates a large scene with a lot of buildings and traffic in it. I've checked the collision part of the code, it simply uses a bounding box to check for collisions, so here are my questions:

  1. the scene is large, which is more than 500 buildings,if I want to add rigid body physics,do I have to add each bounding box to ode static object? so new object such as a box so it can interact with buildings?

  2. add 500 bounding box to ode,what about the speed? or should I use some tricks to do it?

  3. What if I want to keep old collision stuff such as the car do a ray test to building and keep that result? If I can, this building is also added to ode, would it be unnecessary?because the collision box is already in ode,or should I use ode ray test instead of internal ray check? I mean the question basically is what is the efficient way to work with both of collision stuff?

Rasman
  • 5,349
  • 1
  • 25
  • 38
user1051003
  • 1,211
  • 5
  • 16
  • 24
  • 1
    You talk about a certain piece of source code that your boss gave you. Is it OK if you let us see the portion of it that's relevant to your question? – BoltClock Dec 06 '11 at 05:47

1 Answers1

0

Yes, you need to add the bounding box (or mesh) of each of the buildings to ODE. Typically, you will use a QuadTree space, or a Hash space, that contains all of the buildings. The buildings do not need a body, unless you want them to actually move.

You're saying "old collision stuff" -- is there already some collision code in the existing source?

ODE can do ray tests. If you want to use the same methods for all tests, you could change the code to use ODE ray tests, assuming that's what your question is about.

ODE doesn't need to generate the collisions at all. if you already have good collision detection, and just want the rigid body simulation, then generate the right dJointContact joints for each frame to represent the interaction beteween a car and its environment, and simulate (step) only the body/bodies of the car/s, based on those contacts.

Jon Watte
  • 6,579
  • 4
  • 53
  • 63