Parcourir la source

Add support to slope_limit, step_offset and contact_offset to PhysicsResource

Daniele Bartolini il y a 12 ans
Parent
commit
d502f81b0f

+ 6 - 0
engine/compilers/physics/PhysicsCompiler.cpp

@@ -77,10 +77,16 @@ void PhysicsCompiler::parse_controller(JSONElement controller)
 	JSONElement name = controller.key("name");
 	JSONElement height = controller.key("height");
 	JSONElement radius = controller.key("radius");
+	JSONElement slope_limit = controller.key("slope_limit");
+	JSONElement step_offset = controller.key("step_offset");
+	JSONElement contact_offset = controller.key("contact_offset");
 
 	m_controller.name = hash::murmur2_32(name.string_value(), name.size(), 0);
 	m_controller.height = height.float_value();
 	m_controller.radius = radius.float_value();
+	m_controller.slope_limit = slope_limit.float_value();
+	m_controller.step_offset = step_offset.float_value();
+	m_controller.contact_offset = contact_offset.float_value();
 }
 
 //-----------------------------------------------------------------------------

+ 5 - 2
engine/resource/PhysicsResource.h

@@ -46,8 +46,11 @@ struct PhysicsHeader
 struct PhysicsController
 {
 	StringId32 name;
-	float height;
-	float radius;
+	float height;			// Height of the capsule
+	float radius;			// Radius of the capsule
+	float slope_limit;		// The maximum slope which the character can walk up in radians.
+	float step_offset;		// Maximum height of an obstacle which the character can climb.
+	float contact_offset;	// Skin around the object within which contacts will be generated. Use it to avoid numerical precision issues.
 };
 
 //-----------------------------------------------------------------------------