Преглед изворни кода

Correctly set world pose when spawning unit

Daniele Bartolini пре 12 година
родитељ
комит
5e59d9adb5
3 измењених фајлова са 3 додато и 4 уклоњено
  1. 1 2
      engine/physics/Actor.cpp
  2. 1 1
      engine/world/SceneGraph.cpp
  3. 1 1
      engine/world/Unit.cpp

+ 1 - 2
engine/physics/Actor.cpp

@@ -63,8 +63,7 @@ Actor::Actor(PxScene* scene, SceneGraph& sg, int32_t node, ActorType::Enum type,
 	, m_node(node)
 	, m_type(type)
 {
-	Matrix4x4 m(rot, pos);
-	m.transpose();
+	Matrix4x4 m = sg.world_pose(node);
 	PxMat44 pose((PxReal*)(m.to_float_ptr()));
 
 	switch (type)

+ 1 - 1
engine/world/SceneGraph.cpp

@@ -64,7 +64,7 @@ void SceneGraph::create(uint32_t count, const StringId32* name, const Matrix4x4*
 	m_parents = (int32_t*) mem; mem += sizeof(int32_t) * count;
 	m_names = (StringId32*) mem; mem += sizeof(StringId32) * count;
 
-	memset(m_flags, (int) LOCAL_DIRTY | WORLD_DIRTY, sizeof(uint8_t) * count);
+	memset(m_flags, (int) CLEAN, sizeof(uint8_t) * count);
 	memcpy(m_local_poses, local, sizeof(Matrix4x4) * count);
 	memcpy(m_parents, parent, sizeof(int32_t) * count);
 	memcpy(m_names, name, sizeof(StringId32) * count);

+ 1 - 1
engine/world/Unit.cpp

@@ -87,7 +87,7 @@ void Unit::create_objects(const Matrix4x4& pose)
 	m_scene_graph.create(m_resource->num_scene_graph_nodes(), m_resource->scene_graph_names(),
 							m_resource->scene_graph_poses(), m_resource->scene_graph_parents());
 	// Set root node's pose
-	m_scene_graph.set_local_pose(0, pose);
+	m_scene_graph.set_world_pose(0, pose);
 
 	create_camera_objects();
 	create_renderable_objects();