Advertisement
Guest User

Untitled

a guest
Oct 11th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. void CAreaGeneratorElement::PhysicalizeElement()
  2. {
  3.     float mass = GetPropertyFloat(eProperty_Mass);
  4.    
  5.     if (mass < 0.01f)
  6.     {
  7.         SetPropertyFloat(eProperty_Mass, 10.0f);
  8.         mass = 10.0f;
  9.     }
  10.  
  11.     const char *modelPath = GetPropertyValue(eProperty_Model);
  12.    
  13.     if (strlen(modelPath) > 0)
  14.     {
  15.         auto &gameObject = *GetGameObject();
  16.  
  17.         const int geometrySlot = 0;
  18.         LoadMesh(geometrySlot, modelPath);
  19.     }
  20.    
  21.    
  22.     SEntityPhysicalizeParams physicalizationParams;
  23.     physicalizationParams.type = PE_RIGID;
  24.     physicalizationParams.mass = mass;
  25.    
  26.     GetEntity()->Physicalize(physicalizationParams);
  27.     GetEntity()->EnablePhysics(true);
  28.    
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement