OBD talk:OBOA

From OniGalore
Jump to navigation Jump to search

Some collision/physics notes:

Character - Wall collision
this is always sphere tree-quad collision. You probably know that the sphere tree can be seen with "chr_debug_sphere=1". One thing to note about that sphere tree is that it always "stays up" (even when the character is fallen). That's why fallen characters pass through walls, their body gets outside the sphere when that happens.
As for changing the radius of that sphere tree: it may be possible but it won't solve anything.
Character - Floor collision
characters also have a special function to detect floor collision which checks if a 3x3 quad intersects the floor. This is done to avoid "strange" sinking when the sphere's lowest point goes outside the floor. This is the probable cause why sometimes fallen characters hang on an edge (their 3x3 quad still intersects the floor) or fall of the edge even if their feet or head are still on the floor (the 3x3 quad is too small to cover the feet and head when the character is fallen).
Particle - Wall collision
this is always point-quad collision (the point is the position of the particle)
Particle - Object collision (where object is anything with a physics context that supports collision
characters, OBOA objects, powerups, weapons)
this can be sphere-obbox or sphere-sphere collision depending on what the object has (obbox or sphere tree). The radius of the particle sphere is taken from Collision Radius property of the particle class. It can be 0 and then the collision degenerates to point-obbox/point-sphere collision.
Environment collision (general)
The engine can only do point-quad and spheretree-quad collision detection.
Object collision (general)
All objects (that have a physics context) have a sphere tree attached to them and some objects created through OBOA also have an obbox.
Moveable furniture
Yes and no. It can be done to some extent using OBOA.
Basically an OBOA object can be pushed if it's not animated (no OBAN link) and it has "physics type" 2 or 4 (I don't know what's the difference).
What doesn't work:
  • characters fall through objects (the character-floor collision function does not see objects)
  • since the environment only supports sphere-quad collision you tipically cannot push an object very close to the wall (unless of course the object itself is a sphere or close enough to one)
  • objects can fall but because of sphere-quad collision detection they'll get stuck somewhere above the floor
  • an object can fall on another object but a third object will fall through both of them; in general multiple object interaction is buggy
  • if I remember correctly there is 128 physics context limit. That means the number of active characters + objects + powerups and whatever else needs a physics context is limited to 128. Anyway it will very likely crawl before you reach that limit.


What is the point of having a bounding box then? Also, why don't doors use sphere collision? Aren't they OBOAs? Or is it just because of the OBAN attached to them? Gumby 07:39, 14 September 2008 (CEST)