RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
cgameobject.cpp
Go to the documentation of this file.
1 //--------------------------------------------------------------- @License begins
2 // RioEngine: The late night Coke -without whores- debugging sessions
3 // 2012-2015 Leopoldo Lomas Flores. Torreon, Coahuila. MEXICO
4 // leopoldolomas [at] gmail
5 // www.rioengine.com
6 // www.leopoldolomas.info
7 // "You have a problem, you face it like a man."
8 //
9 // This is free and unencumbered software released into the public domain.
10 //
11 // Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
12 // software, either in source code form or as a compiled binary, for any purpose,
13 // commercial or non-commercial, and by any means.
14 //
15 // In jurisdictions that recognize copyright laws, the author or authors of this
16 // software dedicate any and all copyright interest in the software to the public
17 // domain. We make this dedication for the benefit of the public at large and to
18 // the detriment of our heirs and successors. We intend this dedication to be
19 // an overt act of relinquishment in perpetuity of all present and future
20 // rights to this software under copyright law.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
24 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //--------------------------------------------------------------- @License ends
29 
30 #include "constants.h"
31 #include "misc/genericshelper.hpp"
32 #include "misc/stringhelper.hpp"
33 #include "cengine/uidprovider.h"
35 #include "cengine/cactionmanager.h"
37 #include "cengine/cgamescene.h"
38 #include "cengine/cdirector.h"
39 #include "cengine/cgameobject.h"
40 
41 //-----------------------------------------------------------------------------
42 
43 CGameObject::CGameObject() : CLNode() {
44  __init();
45 }
46 
47 //-----------------------------------------------------------------------------
48 
50  m_actionManager = CDIRECTOR->actionManager();
51  m_uid = UIDProvider::nextUID();
52  m_CObjectType = CGameObjectFactory::types().indexOf("CGameObject");
53  transform().setParent(this);
54  m_tag = -1;
55 }
56 
57 //-----------------------------------------------------------------------------
58 
59 CGameObject::CGameObject(const CGameObject& src_game_object) : CLNode() {
60  copyValuesFromObject(src_game_object);
61 }
62 
63 //-----------------------------------------------------------------------------
64 
65 const CGameObject& CGameObject::operator=(const CGameObject& original_obj) {
66  if (this == &original_obj)
67  return *this;
68 
69  copyValuesFromObject(original_obj);
70 
71  return *this;
72 }
73 
74 //-----------------------------------------------------------------------------
75 
77  __init();
78 
79  copyNodeValuesFromNode((CLNode*)&original_obj);
80  setProperty("objectName", original_obj.property("objectName"));
81  m_transform = Transform(original_obj.constTransform());
82  m_CObjectType = original_obj.CObjectType();
83  bulletProperties = original_obj.bulletProperties;
84  m_uid = UIDProvider::nextUID();
85  m_tag = original_obj.tag();
86 
87  setDynamicProperties(original_obj.dynamicProperties());
88 }
89 
90 //-----------------------------------------------------------------------------
91 
92 void CGameObject::setActionManager(CActionManager* action_manager) {
93  if ( m_actionManager != action_manager ) {
94  stopAllActions();
96 
97  m_actionManager = (CActionManager*)action_manager->retain();
98  }
99 }
100 
101 //-----------------------------------------------------------------------------
102 
103 CActionManager* CGameObject::actionManager() const {
104  return m_actionManager;
105 }
106 
107 //-----------------------------------------------------------------------------
108 
109 void CGameObject::setName(const std::string& name) {
110  setProperty("objectName", QString::fromStdString(name));
111 }
112 
113 //-----------------------------------------------------------------------------
114 
115 std::string CGameObject::name() const {
116  return property("objectName").toString().toStdString();
117 }
118 
119 //-----------------------------------------------------------------------------
120 
121 const btVector3 CGameObject::position(Transform::UnitType unit_type) {
122  return transform().localPosition(unit_type);
123 }
124 
125 //-----------------------------------------------------------------------------
126 
127 void CGameObject::setPosition(const btVector3 &value) {
128  transform().setLocalPosition(value);
129 }
130 
131 //-----------------------------------------------------------------------------
132 
133 void CGameObject::setPosition(float x, float y, float z) {
134  setPosition(btVector3(x, y, z));
135 }
136 
137 //-----------------------------------------------------------------------------
138 
139 const btVector3 CGameObject::scale() {
140  return transform().localScale();
141 }
142 
143 //-----------------------------------------------------------------------------
144 
145 void CGameObject::setScale(btVector3 &scale) {
146  transform().setLocalScale(scale);
147 }
148 
149 //-----------------------------------------------------------------------------
150 
151 void CGameObject::setScale(float x, float y, float z) {
152  setScale(btVector3(x, y, z));
153 }
154 
155 //-----------------------------------------------------------------------------
156 
157 void CGameObject::setScale(float _scale) {
158  setScale(btVector3(scale().x() * _scale,
159  scale().y() * _scale,
160  scale().z() * _scale));
161 }
162 
163 //-----------------------------------------------------------------------------
164 
165 btVector3 CGameObject::rotation() {
166  btScalar yaw = 0.0f, pitch = 0.0f, roll = 0.0f;
167  transform().local(true).getInnerTransform().getBasis().getEulerZYX(yaw, pitch, roll); // TODO this call is faster but does not produce the expected output
168  return btVector3(RADTODEG(roll), RADTODEG(pitch), RADTODEG(yaw));
169 }
170 
171 //-----------------------------------------------------------------------------
172 
173 btQuaternion CGameObject::rotationQuat() {
174  return transform().rotation();
175 }
176 
177 //-----------------------------------------------------------------------------
178 
179 void CGameObject::setRotation(const btVector3 &vec_rotation) {
180  btQuaternion rotation = btQuaternion(
181  DEGTORAD(vec_rotation.y()),
182  DEGTORAD(vec_rotation.x()),
183  DEGTORAD(vec_rotation.z()));
184  rotation.normalize();
185  transform().setLocalRotation(rotation);
186 }
187 
188 //-----------------------------------------------------------------------------
189 
190 void CGameObject::setRotation(const btQuaternion& rotation) {
191  transform().setLocalRotation(rotation);
192 }
193 
194 //-----------------------------------------------------------------------------
195 
196 void CGameObject::setRotation(float x, float y, float z) {
197  setRotation(btVector3(x, y, z));
198 }
199 
200 //-----------------------------------------------------------------------------
201 
202 void CGameObject::setRotation(float w, float x, float y, float z) {
203  setRotation(btQuaternion(w, x, y, z));
204 }
205 
206 //-----------------------------------------------------------------------------
207 
208 const QList<QProperty> CGameObject::dynamicProperties() const {
209  QList<QProperty> dynamic_properties = QList<QProperty>();
210  QList<QByteArray> prop_names = dynamicPropertyNames();
211  QListIterator<QByteArray> it(prop_names);
212  while (it.hasNext()) {
213  QByteArray name = it.next();
214  dynamic_properties.append(QProperty(QString(name), property(qPrintable(name))));
215  }
216  return dynamic_properties;
217 }
218 
219 //-----------------------------------------------------------------------------
220 
221 void CGameObject::setDynamicProperties(QList<QProperty> dynamic_properties) {
222  QListIterator<QProperty> it(dynamic_properties);
223  while (it.hasNext()) {
224  QProperty property = it.next();
225  setProperty(qPrintable(property.objectName()), property.value());
226  }
227 }
228 
229 //-----------------------------------------------------------------------------
230 
231 int CGameObject::CObjectType() const {
232  return m_CObjectType;
233 }
234 
235 //-----------------------------------------------------------------------------
236 
237 void CGameObject::setCObjectType(int val) {
238  m_CObjectType = val;
239 }
240 
241 //-----------------------------------------------------------------------------
242 
243 const QString& CGameObject::CObjectTypeName() const {
244  return CGameObjectFactory::getTypeNameHavingId(m_CObjectType);
245 }
246 
247 //-----------------------------------------------------------------------------
248 
249 void CGameObject::setCObjectTypeName(const QString& type_name) {
250  m_CObjectType = CGameObjectFactory::getObjectTypeId(qPrintable(type_name));
251 }
252 
253 //-----------------------------------------------------------------------------
254 
255 unsigned int CGameObject::uid() const {
256  return m_uid;
257 }
258 
259 //-----------------------------------------------------------------------------
260 
261 const bool CGameObject::bPhysicsEnabled() const {
262  return bulletProperties.physicsEnabled();
263 }
264 
265 //-----------------------------------------------------------------------------
266 
267 void CGameObject::setbPhysicsEnabled(bool physics_enabled) {
268  bulletProperties.setPhysicsEnabled(physics_enabled);
269 }
270 
271 //-----------------------------------------------------------------------------
272 
273 const float CGameObject::bMass() const {
274  return bulletProperties.mass();
275 }
276 
277 //-----------------------------------------------------------------------------
278 
279 void CGameObject::setbMass(float mass) {
280  bulletProperties.setMass(mass);
281 }
282 
283 //-----------------------------------------------------------------------------
284 
285 const float CGameObject::bRestitution() const {
286  return bulletProperties.restitution();
287 }
288 
289 //-----------------------------------------------------------------------------
290 
291 void CGameObject::setbRestitution(float restitution) {
292  bulletProperties.setRestitution(restitution);
293 }
294 
295 //-----------------------------------------------------------------------------
296 
297 const float CGameObject::bFriction() const {
298  return bulletProperties.friction();
299 }
300 
301 void CGameObject::setbFriction(float friction) {
302  bulletProperties.setFriction(friction);
303 }
304 
305 const btVector3& CGameObject::bLinearFactor() const {
306  return bulletProperties.linearFactor();
307 }
308 
309 //-----------------------------------------------------------------------------
310 
311 void CGameObject::setbLinearFactor(const btVector3 &linear_factor) {
312  bulletProperties.setLinearFactor(linear_factor);
313 }
314 
315 //-----------------------------------------------------------------------------
316 
317 const btVector3& CGameObject::bAngularFactor() const {
318  return bulletProperties.angularFactor();
319 }
320 
321 //-----------------------------------------------------------------------------
322 
323 void CGameObject::setbAngularFactor(const btVector3 &angular_factor) {
324  bulletProperties.setAngularFactor(angular_factor);
325 }
326 
327 //-----------------------------------------------------------------------------
328 
329 const CBulletProperties::ShapeTypes CGameObject::shapeType() const {
330  return bulletProperties.shapeType();
331 }
332 
333 //-----------------------------------------------------------------------------
334 
335 void CGameObject::setShapeType(CBulletProperties::ShapeTypes shape_type) {
336  bulletProperties.setShapeType(shape_type);
337 }
338 
339 //-----------------------------------------------------------------------------
340 
341 const float CGameObject::bShapeTypeRadius() const {
342  return bulletProperties.radius();
343 }
344 
345 //-----------------------------------------------------------------------------
346 
347 void CGameObject::setbShapeTypeRadius(float radius) {
348  bulletProperties.setRadius(radius);
349 }
350 
351 //-----------------------------------------------------------------------------
352 
353 const float CGameObject::bShapeTypeHeight() const {
354  return bulletProperties.height();
355 }
356 
357 //-----------------------------------------------------------------------------
358 
359 void CGameObject::setbShapeTypeHeight(float height) {
360  bulletProperties.setHeight(height);
361 }
362 
363 //-----------------------------------------------------------------------------
364 
365 const btVector3 CGameObject::bShapeTypeSize() const {
366  return bulletProperties.size();
367 }
368 
369 //-----------------------------------------------------------------------------
370 
371 void CGameObject::setbShapeTypeSize(btVector3 &size) {
372  bulletProperties.setSize(size);
373 }
374 
375 //-----------------------------------------------------------------------------
376 
377 const QString CGameObject::bShapeTypeVertices() const {
378  return bulletProperties.vertices();
379 }
380 
381 //-----------------------------------------------------------------------------
382 
383 void CGameObject::setbShapeTypeVertices(QString vertices) {
384  bulletProperties.setVertices(vertices);
385 }
386 
387 //-----------------------------------------------------------------------------
388 
389 const btVector3 CGameObject::bShapeTypePlaneNormal() const {
390  return bulletProperties.planeNormal();
391 }
392 
393 //-----------------------------------------------------------------------------
394 
395 void CGameObject::setbShapeTypePlaneNormal(btVector3 &plane_normal) {
396  bulletProperties.setPlaneNormal(plane_normal);
397 }
398 
399 //-----------------------------------------------------------------------------
400 
401 const float CGameObject::bShapeTypePlaneConstant() const {
402  return bulletProperties.planeConstant();
403 }
404 
405 //-----------------------------------------------------------------------------
406 
407 void CGameObject::setbShapeTypePlaneConstant(float plane_constant) {
408  bulletProperties.setPlaneConstant(plane_constant);
409 }
410 
411 //-----------------------------------------------------------------------------
412 
413 const CBulletProperties::ActivationState CGameObject::activationState() const {
414  return bulletProperties.activationState();
415 }
416 
417 //-----------------------------------------------------------------------------
418 
419 void CGameObject::setActivationState(CBulletProperties::ActivationState activation_state) {
420  bulletProperties.setActivationState(activation_state);
421 }
422 
423 //-----------------------------------------------------------------------------
424 
425 btCollisionShape* CGameObject::collisionShape() {
426  QVariant value = property("ShapeType_Size");
427  btVector3 size = *static_cast<btVector3*>(value.data());
428  btVector3 bt_size = btVector3(size.x(), size.y(), size.z());
429 
430  value = property("ShapeType_PlaneNormal");
431  size = *static_cast<btVector3*>(value.data());
432  btVector3 plane_normal = btVector3(size.x(), size.y(), size.z());
433 
434  float radius = property("ShapeType_Radius").toFloat();
435  float height = property("ShapeType_Height").toFloat();
436  float plane_constant = property("ShapeType_PlaneConstant").toFloat();
437 
438  QString vertices_str = property("ShapeType_Vertices").toString();
439  std::vector<std::string> vertices_vec = StringHelper::split(vertices_str.toStdString(), " ");
440  std::vector<float> fixed_vertices_vec;
441  for (std::vector<std::string>::iterator it = vertices_vec.begin();
442  it != vertices_vec.end();
443  ++it) {
444  char* p;
445  float converted = strtol((*it).c_str(), &p, 10);
446  if (*p) {
447  fixed_vertices_vec.push_back(0);
448  } else {
449  fixed_vertices_vec.push_back(converted);
450  }
451  }
452  int vertices_count = fixed_vertices_vec.size();
453  btScalar* vertices = new btScalar[vertices_count];
454  for (unsigned int i = 0; i < fixed_vertices_vec.size(); i++) {
455  vertices[i] = fixed_vertices_vec[i];
456  }
457 
458  btCollisionShape* collision_shape = NULL;
459  switch (bulletProperties.shapeType()) {
461  collision_shape = new btBoxShape(bt_size);
462  break;
464  collision_shape = new btSphereShape(radius);
465  break;
467  collision_shape = new btStaticPlaneShape(plane_normal, plane_constant);
468  break;
470  collision_shape = new btConeShape(radius, height);
471  break;
473  collision_shape = new btCapsuleShape(radius, height);
474  break;
476  collision_shape = new btCylinderShape(bt_size);
477  break;
479  collision_shape = new btConvexHullShape(vertices, vertices_count);
480  break;
482  // TODO
483  break;
484  }
485  SAFE_RELEASE(vertices);
486 
487  return collision_shape;
488 }
489 
490 //-----------------------------------------------------------------------------
491 
492 CGameScene* CGameObject::parentScene() const {
493  QObject* _parent = parent();
494  RE_ASSERT(_parent);
495  while (_parent) {
496  bool is_game_scene = (qobject_cast<CGameScene*>(_parent) != NULL);
497  if (is_game_scene) {
498  break;
499  }
500  _parent = _parent->parent();
501  }
502  RE_ASSERT(_parent);
503 
504  return reinterpret_cast<CGameScene*>(_parent);
505 }
506 
507 //-----------------------------------------------------------------------------
508 
509 void CGameObject::start() {
510 }
511 
512 //-----------------------------------------------------------------------------
513 
514 void CGameObject::preUpdate() {
515 }
516 
517 //-----------------------------------------------------------------------------
518 
519 void CGameObject::update() {
520 }
521 
522 //-----------------------------------------------------------------------------
523 
524 void CGameObject::postWorldUpdate() {
525 }
526 
527 //-----------------------------------------------------------------------------
528 
529 void CGameObject::postUpdate() {
530 }
531 
532 //-----------------------------------------------------------------------------
533 
534 void CGameObject::runAction(CAction* action) {
535  RE_ASSERT(action);
536  m_actionManager->addAction(action, this, false);
537 }
538 
539 //-----------------------------------------------------------------------------
540 
541 void CGameObject::stopAllActions() {
543 }
544 
545 //-----------------------------------------------------------------------------
546 
547 void CGameObject::stopAction(CAction* action) {
548  m_actionManager->removeAction(action);
549 }
550 
551 //-----------------------------------------------------------------------------
552 
553 void CGameObject::stopActionByTag(unsigned int a_tag) {
554  // RE_ASSERT( aTag != kCCActionTagInvalid, @"Invalid tag");
555  m_actionManager->removeActionByTag(a_tag, this);
556 }
557 
558 //-----------------------------------------------------------------------------
559 
560 CAction* CGameObject::getActionByTag(unsigned int a_tag) {
561  // RE_ASSERT( aTag != kCCActionTagInvalid, @"Invalid tag");
562  return m_actionManager->getActionByTag(a_tag, this);
563 }
564 
565 //-----------------------------------------------------------------------------
566 
567 unsigned int CGameObject::numberOfRunningActions() {
569 }
570 
571 //-----------------------------------------------------------------------------
572 
573 void CGameObject::deployIntoDynamicsWorld() {
574  if (bulletProperties.rigidBody()) {
575  return;
576  }
577  RE_ASSERT(parent());
578 
579  CGameScene* parent_scene = parentScene();
580  btCollisionShape* collision_shape = collisionShape();
581  RE_ASSERT(collision_shape);
582 
583  btCustomTransform _transform = transform().global(false);
584  _transform.getInnerTransform().setOrigin(_transform.getInnerTransform().getOrigin() * k_QGLGameEditorViewport_SizeFactor);
585 
586  btDefaultMotionState* motion_state = new btDefaultMotionState(_transform.getInnerTransform());
587  btRigidBody::btRigidBodyConstructionInfo rigid_body_ci(bulletProperties.mass(),
588  motion_state,
589  collision_shape);
590  rigid_body_ci.m_restitution = property("Restitution").toFloat();
591  rigid_body_ci.m_friction = property("Friction").toFloat();
592  btRigidBody* rigid_body = new btRigidBody(rigid_body_ci);
593  rigid_body->setUserPointer(this);
594  rigid_body->setActivationState(bulletProperties.activationState());
595  parent_scene->dynamicsWorld()->addRigidBody(rigid_body);
596  rigid_body->setWorldTransform(_transform.getInnerTransform());
597  bulletProperties.setRigidBody(rigid_body);
598  bulletProperties.setPhysicsEnabled(true);
599 }
600 
601 //-----------------------------------------------------------------------------
602 
603 void CGameObject::removeFromDynamicsWorld() {
604  btRigidBody* body = bulletProperties.rigidBody();
605  if (!body) {
606  return;
607  }
608  RE_ASSERT(parent());
609 
610  CGameScene* parent_scene = parentScene();
611 
612  parent_scene->dynamicsWorld()->removeRigidBody(body);
613  SAFE_RELEASE(body->getMotionState());
614  SAFE_RELEASE(body->getCollisionShape());
615  SAFE_RELEASE(body);
616  bulletProperties.setRigidBody(NULL);
617 }
618 
619 //-----------------------------------------------------------------------------
620 
621 void CGameObject::updateBulletProperties() {
622  btVector3 fixed_size = m_size * k_QGLGameEditorViewport_SizeFactor * 0.5f; // TODO too hacky
623  float largest_axis = std::max(std::max(fixed_size.x(), fixed_size.y()), fixed_size.z());
624 
625  setbShapeTypeRadius(largest_axis);
626  setbShapeTypeSize(fixed_size);
627  setbShapeTypeHeight(fixed_size.y());
628 }
629 
630 //-----------------------------------------------------------------------------
631 
632 int CGameObject::tag() const {
633  return m_tag;
634 }
635 
636 //-----------------------------------------------------------------------------
637 
638 void CGameObject::setTag(int tag) {
639  m_tag = tag;
640 }
641 
642 //-----------------------------------------------------------------------------
643 
644 const btVector3& CGameObject::calcSize() {
646  updateBulletProperties();
647  return m_size;
648 }
649 
650 //-----------------------------------------------------------------------------
651 
652 void CGameObject::addChild(CGameObject* child) {
653  RE_ASSERT(child);
654  SAFE_RETAIN(child);
655  child->setParent(this);
656 }
657 
658 //-----------------------------------------------------------------------------
659 
660 void CGameObject::onCollisionWithObject(CGameObject* object) {
661 }
662 
663 //-----------------------------------------------------------------------------
664 
665 void CGameObject::aboutToBeRemoved() {
666 }
667 
668 //-----------------------------------------------------------------------------
669 
670 void CGameObject::remove() {
671  stopAllActions();
672  parentScene()->removeGameObjectWhenAble(this);
673 }
674 
675 //-----------------------------------------------------------------------------
676 
677 CGameObject::~CGameObject(void) {
678  removeFromDynamicsWorld(); // remove body from dynamics world (bullet physics)
679  // remove children
680  std::vector<CGameObject*>* gameobjs_to_remove = new std::vector<CGameObject*>();
681  for (QList<QObject*>::const_iterator it = children().begin();
682  it != children().end();
683  ++it) {
684  if (qobject_cast<CGameObject*>(*it) != NULL) {
685  CGameObject* game_obj = static_cast<CGameObject*>(*it);
686  game_obj->stopAllActions();
687  //SAFE_RELEASE(game_obj); // we can't release the object yet, otherwise it will crash
688  gameobjs_to_remove->push_back(game_obj);
689  }
690  }
691  GenericsHelper::deleteVector(gameobjs_to_remove);
692 }
void removeAction(CAction *action)
btCustomTransform & local(bool scale=true) const
Definition: transform.cpp:302
const float planeConstant() const
static const QStringList & types()
void removeActionByTag(unsigned int tag, CGameObject *target)
btCustomTransform global(bool scale=true) const
Definition: transform.cpp:322
int CObjectType
Definition: cgameobject.h:50
void copyNodeValuesFromNode(CLNode *node)
Definition: clnode.cpp:123
void setPhysicsEnabled(bool physics_enabled)
void setFriction(float friction)
void setRadius(float radius)
virtual const btVector3 & calcSize()
Definition: clnode.cpp:194
void setRigidBody(btRigidBody *rigid_body)
Transform m_transform
Definition: clnode.h:77
const float height() const
const btVector3 & linearFactor() const
btQuaternion rotation() const
Definition: transform.cpp:93
static void deleteVector(std::vector< T * > *vec)
const ShapeTypes shapeType() const
btTransform + Scale Matrix
void setLocalScale(float x, float y, float z)
Definition: transform.cpp:180
const float friction() const
Definition: clnode.h:37
virtual void copyValuesFromObject(const CGameObject &game_object)
Definition: cgameobject.cpp:76
void setLinearFactor(const btVector3 &linear_factor)
btDiscreteDynamicsWorld * dynamicsWorld() const
Definition: cgamescene.cpp:86
const QString & vertices() const
virtual void __init()
Definition: cgameobject.cpp:49
void setPlaneNormal(const btVector3 &plane_normal)
const btVector3 & localPosition(UnitType unit_type=WORLD) const
Definition: transform.cpp:105
unsigned int numberOfRunningActionsInTarget(CGameObject *target)
static unsigned int nextUID()
Definition: uidprovider.cpp:44
void setHeight(float height)
void setPlaneConstant(float plane_constant)
const float mass() const
void setLocalRotation(float w, float x, float y, float z)
Definition: transform.cpp:209
const Transform & constTransform() const
Definition: clnode.cpp:75
void setShapeType(ShapeTypes shape_type)
void setVertices(const QString &vertices)
CActionManager * m_actionManager
Definition: cgameobject.h:255
const float restitution() const
CAction * getActionByTag(unsigned int tag, CGameObject *game_object)
#define SAFE_RELEASE(x)
Definition: cobject.h:36
const float radius() const
btVector3 m_size
Definition: clnode.h:78
btVector3 localScale() const
Definition: transform.cpp:123
const bool physicsEnabled() const
const btVector3 & size() const
static int getObjectTypeId(const char *class_name)
#define SAFE_RETAIN(x)
Definition: cobject.h:35
const btVector3 & angularFactor() const
void setAngularFactor(const btVector3 &angular_factor)
void addAction(CAction *action, CGameObject *target, bool paused)
#define RE_ASSERT
Definition: macro.h:57
btTransform & getInnerTransform()
#define DEGTORAD(x)
Definition: macro.h:52
void setSize(const btVector3 &size)
btRigidBody * rigidBody() const
#define CDIRECTOR
Definition: cdirector.h:37
void removeAllActionsFromTarget(CGameObject *target)
const btVector3 & planeNormal() const
static const QString & getTypeNameHavingId(int type_id)
void setActivationState(const CBulletProperties::ActivationState &activationState)
void setLocalPosition(float x, float y, float z)
Definition: transform.cpp:165
void removeGameObjectWhenAble(CGameObject *game_object)
Definition: cgamescene.cpp:374
#define RADTODEG(x)
Definition: macro.h:53
void setMass(float mass)
Transform & transform()
Definition: clnode.cpp:69
static std::vector< std::string > split(const std::string &str, const std::string &delimiters)
CBulletProperties::ActivationState activationState() const
CObject * retain()
Definition: cobject.cpp:66
void setRestitution(float restitution)