| 209 | } |
| 210 | |
| 211 | void ItemObject::MakeBulletObject() { |
| 212 | if (!bullet_object_ && scenegraph_) { |
| 213 | bullet_object_ = scenegraph_->bullet_world_->CreateConvexModel( |
| 214 | vec3(0.0f), |
| 215 | ofc_->model_name, |
| 216 | &display_phys_offset_); |
| 217 | bullet_object_->keep_history = true; |
| 218 | Model& model = Models::Instance()->GetModel(model_id_); |
| 219 | phys_offset_ = model.old_center + display_phys_offset_; |
| 220 | bullet_object_->owner_object = this; |
| 221 | vec3 new_pos = GetTranslation() + |
| 222 | GetRotation() * display_phys_offset_; |
| 223 | bullet_object_->SetTransform(new_pos, Mat4FromQuaternion(GetRotation()), vec4(1.0f)); |
| 224 | bullet_object_->SetMass(item_ref_->GetMass()); |
| 225 | bullet_object_->body->setCcdMotionThreshold(0.000001f); |
| 226 | bullet_object_->body->setCcdSweptSphereRadius(0.05f); |
| 227 | |
| 228 | abstract_bullet_object_ = scenegraph_->abstract_bullet_world_->CreateConvexModel( |
| 229 | vec3(0.0f), |
| 230 | ofc_->model_name, |
| 231 | &display_phys_offset_, |
| 232 | BW_ABSTRACT_ITEM); |
| 233 | abstract_bullet_object_->body->setCollisionFlags(abstract_bullet_object_->body->getCollisionFlags() | |
| 234 | btCollisionObject::CF_NO_CONTACT_RESPONSE); |
| 235 | abstract_bullet_object_->keep_history = true; |
| 236 | abstract_bullet_object_->owner_object = this; |
| 237 | abstract_bullet_object_->SetTransform(new_pos, Mat4FromQuaternion(GetRotation()), vec4(1.0f)); |
| 238 | abstract_bullet_object_->body->setInterpolationWorldTransform(abstract_bullet_object_->body->getWorldTransform()); |
| 239 | abstract_bullet_object_->Activate(); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | bool ItemObject::Initialize() { |
| 244 | update_list_entry = scenegraph_->LinkUpdateObject(this); |
nothing calls this directly
no test coverage detected