Skip to content

Commit 8b0290b

Browse files
committed
Added Matrix3x4.position and angles
1 parent d7bd658 commit 8b0290b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/core/modules/mathlib/mathlib.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,20 @@ class matrix3x4_tExt
175175
+ str(__getitem__(matrix, 1)) + ",\n"
176176
+ str(__getitem__(matrix, 2)) + "]");
177177
}
178+
179+
static Vector* get_position(matrix3x4_t& matrix)
180+
{
181+
Vector* result = new Vector();
182+
MatrixPosition(matrix, *result);
183+
return result;
184+
}
185+
186+
static QAngle* get_angles(matrix3x4_t& matrix)
187+
{
188+
QAngle* result = new QAngle();
189+
MatrixAngles(matrix, *result);
190+
return result;
191+
}
178192
};
179193

180194
#endif // _MATHLIB_H

src/core/modules/mathlib/mathlib_wrap.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,18 @@ void export_matrix3x4_t(scope _mathlib)
540540
manage_new_object_policy(),
541541
"Return a single row of the matrix (0 - 2).\n\n"
542542
":rtype: tuple")
543+
544+
.add_property(
545+
"position",
546+
make_function(&matrix3x4_tExt::get_position, manage_new_object_policy()),
547+
"Extract the position from the matrix.\n\n"
548+
":rtype: Vector")
549+
550+
.add_property(
551+
"angles",
552+
make_function(&matrix3x4_tExt::get_angles, manage_new_object_policy()),
553+
"Extract the angles from the matrix.\n\n"
554+
":rtype: QAngle")
543555

544556
ADD_MEM_TOOLS(matrix3x4_t)
545557
;

0 commit comments

Comments
 (0)