diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index 284797ba29..d4e23126e8 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -1316,6 +1316,19 @@ get_relative_point(const NodePath &other, const LVecBase3f &point) { return rel_point; } +//////////////////////////////////////////////////////////////////// +// Function: NodePath::get_relative_vector +// Access: Published +// Description: Given that the indicated vector is in the coordinate +// system of the other node, returns the same vector in +// this node's coordinate system. +//////////////////////////////////////////////////////////////////// +LVector3f NodePath:: +get_relative_vector(const NodePath &other, const LVecBase3f &vec) { + LVector3f rel_vector = LVector3f(vec) * other.get_mat(*this); + return rel_vector; +} + //////////////////////////////////////////////////////////////////// // Function: NodePath::look_at // Access: Published diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 40b834ae55..199ca1cfc7 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -378,6 +378,7 @@ PUBLISHED: void set_mat(const NodePath &other, const LMatrix4f &mat); LPoint3f get_relative_point(const NodePath &other, const LVecBase3f &point); + LVector3f get_relative_vector(const NodePath &other, const LVecBase3f &vec); INLINE void look_at(const NodePath &other, float x, float y, float z);