MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Entity

Method Entity

engine/Poseidon/World/Simulation/Simul.cpp:361–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359DEFINE_CASTING(Entity)
360
361Entity::Entity(LODShapeWithShadow* shape, const EntityType* type, int id)
362 : Object(shape ? shape : type->GetShape(), id), _type(const_cast<EntityType*>(type)), _delete(false),
363 _convertToObject(false), _moveOutState(MOIn), _local(true), _prec(SimulateDefault),
364
365 _objectContact(false), _landContact(true), _waterContact(false),
366
367 _constantColor(PackedWhite),
368
369 _simulationPrecision(1.0 / 15), _simulationSkipped(0),
370
371 _invAngInertia(M3Identity), _speed(VZero), _modelSpeed(VZero), _acceleration(VZero), _angVelocity(VZero),
372 _angMomentum(VZero),
373
374 _invTransform(MIdentity), _invDirty(false), _impulseForce(VZero), _impulseTorque(VZero),
375
376 _targetSide(TCivilian)
377{
378 if (!type)
379 {
380 if (_shape)
381 {
382 LOG_DEBUG(Physics, "No type, shape {}", (const char*)_shape->Name());
383 }
384 Fail("No type");
385 }
386 _type->VehicleAddRef();
387 _disableDammageUntil = Glob.time + 2;
388 Matrix3Val orientation = Orientation();
389 if (_shape)
390 {
391 _invAngInertia = orientation * _shape->InvInertia() * orientation.InverseScaled();
392 }
393 else
394 {
395 _invAngInertia = M3Identity;
396 }
397 _static = false;
398 _destrType = DestructNo;
399 Object::_type = TypeVehicle;
400
401 _animateTexturesTimes.Realloc(type->_animateTextures.Size());
402 _animateTexturesTimes.Resize(type->_animateTextures.Size());
403 for (int i = 0; i < type->_animateTextures.Size(); i++)
404 {
405 _animateTexturesTimes[i] = 0;
406 }
407
408 _animations.Realloc(type->_animations.Size());
409 _animations.Resize(type->_animations.Size());
410 for (int i = 0; i < type->_animations.Size(); i++)
411 {
412 _animations[i].SetType(type->_animations[i]);
413 }
414}
415
416Entity::~Entity()
417{

Callers

nothing calls this directly

Calls 9

VehicleAddRefMethod · 0.80
InvInertiaMethod · 0.80
SetTypeMethod · 0.80
GetShapeMethod · 0.45
NameMethod · 0.45
InverseScaledMethod · 0.45
ReallocMethod · 0.45
SizeMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected