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

Method StickToEnvironment

Source/Objects/itemobject.cpp:853–863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

851}
852
853void ItemObject::StickToEnvironment(const vec3& pos, int vert, const CollideInfo& collide_info) {
854 sticking_collision_occured_ = false;
855 stuck_in_environment_ = true;
856 vec3 vert_pos = ModelToWorldPos(GetVertPos(vert)) - bullet_object_->GetPosition();
857 bullet_object_->SetPosition(pos - vert_pos - collide_info.normal * 0.15f * pow(item_ref_->GetMass(), 0.5f));
858 bullet_object_->SetLinearVelocity(vec3(0.0f));
859 bullet_object_->SetAngularVelocity(vec3(0.0f));
860 bullet_object_->SetMargin(0.0f);
861 scenegraph_->bullet_world_->UnlinkObject(bullet_object_);
862 stuck_transform_ = bullet_object_->GetTransform();
863}
864
865vec3 ItemObject::WorldToModelPos(const vec3& pos) {
866 return invert(bullet_object_->GetTransform()) * pos + display_phys_offset_;

Callers

nothing calls this directly

Calls 10

powFunction · 0.50
vec3Class · 0.50
GetPositionMethod · 0.45
SetPositionMethod · 0.45
GetMassMethod · 0.45
SetLinearVelocityMethod · 0.45
SetAngularVelocityMethod · 0.45
SetMarginMethod · 0.45
UnlinkObjectMethod · 0.45
GetTransformMethod · 0.45

Tested by

no test coverage detected