Jump to content

OBD:OBOA: Difference between revisions

moved in physics details from OBD:OBAN and added some more
(elaborated on physics (more can probably be done here); various other wording tweaks and elaboration; placed sections under section headers so they are linkable from other articles)
(moved in physics details from OBD:OBAN and added some more)
Line 41: Line 41:
:2 - Linear; response to external forces and collision (if any); never used in vanilla data
:2 - Linear; response to external forces and collision (if any); never used in vanilla data
:3 - Animated; used for non-doors
:3 - Animated; used for non-doors
:4 - "Newton"; response to external forces and collision (if any); never used in vanilla data
:4 - Newton; functions equivalently to Linear; never used in vanilla data
}}
}}
{{OBDtr| 0x1C | uint32    |C87C64| FF FF 00 00 | 65535    | script ID (for obj_create, env_setanim etc); doors use 65535 }}
{{OBDtr| 0x1C | uint32    |C87C64| FF FF 00 00 | 65535    | script ID (for obj_create, env_setanim etc); doors use 65535 }}
Line 77: Line 77:


==Physics==
==Physics==
Physics may work if you set one of the "physics level" flags, but the implementation is buggy and incomplete: you may be able to add a object that can be pushed around, but if you try to jump on it you'll fall. If you run into an object, the collision will stop you, but an animated object cannot push you; intercepting a moving object with a moving character, for instance running towards Muro's van as it escapes Vago Lab, will stop you at the moment when you contact one of its collision spheres but you will not be pushed backward by the van and it will proceed to pass through you, allowing you to resume running forward. The two flavors of physics, "Linear" and "Newton", are equivalent; if there were differences between the two during development, they are gone now.
Physics may work if you set one of the "physics level" flags, but the implementation is buggy and incomplete: you may be able to add a object that can be pushed around, but if you try to jump on it you'll fall. If you run into an object, the collision will stop you, but an animated object cannot push you; intercepting a moving object with a moving character, for instance running towards Muro's van as it escapes Vago Lab, will stop you at the moment when you contact one of its collision spheres but you will not be pushed backward by the van and it will proceed to pass through you, allowing you to resume running forward.


Proper physics also requires an accurate bounding volume, but the default spherical bounding volume that the engine calculates for each object is often incorrectly tiny, especially when a single object consists of two separate bodies (e.g. a pair of wheels on a vehicle). Sometimes the sphere ''is'' correctly fit to the object geometry but the object is narrow (e.g. a cable) and so the encompassing sphere is uncomfortably large, resulting in collision with a large invisible space around the object where a player would not expect it. To see the calculated collision volumes of objects, use <code>ob_show_debug=1</code>.
You can shoot Muro's van as it drives away from you and you will see your shots impacting the rear door, but if you study the collisions closely you will see that they are striking an invisible sphere that encompasses the visible doors. So-called "face collision" can be requested in the OBOA setup and it will calculate and use bounding boxes for collision instead of spheres, but the FaceCollision flag is only set in the vanilla game data for doors – apparently Bungie West probably never felt the need for accurate collision on environmental objects created with OBOA because they didn't expect the player to interact with them; more or less all animations play during cutscenes where the player doesn't have control. Also, for rounder objects, it's hard to tell the difference between accurate spherical collision and accurate bounding box collision anyway.
 
That being said, the default spherical bounding volume that the engine calculates for each object is often incorrectly tiny, especially when a single object consists of two separate bodies (e.g. the pair of wheels on Muro's van, script ID 5, in level3_Final). Sometimes the sphere ''is'' correctly fit to the object geometry but the object is narrow (e.g. the crane cable over the acid vat, script ID 72, in level14_Final) and so the encompassing sphere is uncomfortably large, resulting in collision with a large invisible space around the object where a player would not expect it. To see the calculated collision volumes of objects, use <code>ob_show_debug=1</code>.


Position, rotation and scale are used only when the object is not animated, otherwise the origin matrix is used instead.
Position, rotation and scale are used only when the object is not animated, otherwise the origin matrix is used instead.