MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / CreatePhysicsShape

Method CreatePhysicsShape

Source/Objects/envobject.cpp:1239–1260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239void EnvObject::CreatePhysicsShape() {
1240 BWFlags flags = BW_NO_FLAGS;
1241 if (ofr->no_collision) {
1242 flags |= BW_DECALS_ONLY;
1243 }
1244 BulletWorld* bw = GetBulletWorld();
1245 if (ofr->bush_collision) {
1246 CreateBushPhysicsShape();
1247 } else {
1248 int id = GetCollisionModelID();
1249 Model* model = &Models::Instance()->GetModel(id);
1250 normal_override_buffer_dirty = true;
1251 bullet_object_ = bw->CreateStaticMesh(model, id, flags);
1252 }
1253 if (bullet_object_) {
1254 bullet_object_->owner_object = this;
1255 bullet_object_->SetTransform(GetTranslation(), Mat4FromQuaternion(GetRotation()), GetScale());
1256 bullet_object_->UpdateTransform();
1257 bullet_object_->UpdateTransform();
1258 bw->UpdateSingleAABB(bullet_object_);
1259 }
1260}
1261
1262void EnvObject::RemovePhysicsShape() {
1263 if (bullet_object_) {

Callers

nothing calls this directly

Calls 9

GetTranslationFunction · 0.85
Mat4FromQuaternionFunction · 0.85
GetRotationFunction · 0.85
GetScaleFunction · 0.85
CreateStaticMeshMethod · 0.80
UpdateSingleAABBMethod · 0.80
GetModelMethod · 0.45
SetTransformMethod · 0.45
UpdateTransformMethod · 0.45

Tested by

no test coverage detected