瀏覽代碼

Polish a little bit Actor code

Daniele Bartolini 12 年之前
父節點
當前提交
a5ce529ae8
共有 2 個文件被更改,包括 7 次插入10 次删除
  1. 1 6
      engine/physics/Actor.cpp
  2. 6 4
      engine/physics/Actor.h

+ 1 - 6
engine/physics/Actor.cpp

@@ -80,13 +80,8 @@ Actor::Actor(SceneGraph& sg, int32_t node, ActorType::Enum type, const Vector3&
 
 			if (type == ActorType::DYNAMIC_KINEMATIC)
 			{
-				Log::d("KINEMATIC");
 				static_cast<PxRigidDynamic*>(m_actor)->setRigidDynamicFlag(PxRigidDynamicFlag::eKINEMATIC, true);
 			}
-			else
-			{
-				Log::d("PHYSICAL");
-			}
 			break;
 		}
 		default:
@@ -101,7 +96,7 @@ Actor::Actor(SceneGraph& sg, int32_t node, ActorType::Enum type, const Vector3&
 	
 	create_box(Vector3(0, 0, 0), .5, .5, .5);
 
-	PxRigidBodyExt::setMassAndUpdateInertia(*static_cast<PxRigidDynamic*>(m_actor), 10.0f);
+	PxRigidBodyExt::setMassAndUpdateInertia(*static_cast<PxRigidDynamic*>(m_actor), 500.0f);
 
 	PxD6Joint* joint = PxD6JointCreate(*device()->physx(), m_actor, PxTransform(pose), NULL, PxTransform(pose));
 	joint->setMotion(PxD6Axis::eX, PxD6Motion::eFREE);

+ 6 - 4
engine/physics/Actor.h

@@ -53,10 +53,6 @@ struct Actor
 						Actor(SceneGraph& sg, int32_t node, ActorType::Enum type, const Vector3& pos, const Quaternion& rot);
 						~Actor();
 
-	void				create_sphere(const Vector3& position, float radius);
-	void				create_box(const Vector3& position, float a, float b, float c);
-	void				create_plane(const Vector3& position, const Vector3& normal);
-
 	void				enable_gravity();
 	void				disable_gravity();
 
@@ -84,6 +80,12 @@ struct Actor
 	void				update_pose();
 	void				update(const Matrix4x4& pose);
 
+private:
+
+	void				create_sphere(const Vector3& position, float radius);
+	void				create_box(const Vector3& position, float a, float b, float c);
+	void				create_plane(const Vector3& position, const Vector3& normal);
+	
 public:
 
 	SceneGraph&			m_scene_graph;