1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-14 01:19:59 +00:00

Can be used from any scripts

This commit is contained in:
MaxYari 2025-03-09 19:09:11 +01:00
parent 5d5ad0c832
commit 7c5d60837b

View File

@ -223,11 +223,10 @@ namespace MWLua
{ "CarriedRight", MWWorld::InventoryStore::Slot_CarriedRight },
{ "CarriedLeft", MWWorld::InventoryStore::Slot_CarriedLeft },
{ "Ammunition", MWWorld::InventoryStore::Slot_Ammunition } }));
actor["getBonePosition"] = [](const GObject& o, std::string_view boneName) -> sol::optional<osg::Vec3f> {
actor["getBonePosition"] = [](const Object& o, std::string_view boneName) -> sol::optional<osg::Vec3f> {
const MWWorld::Class& cls = o.ptr().getClass();
// Need to accept self OR a global object
/*if (!cls.isActor())
throw std::runtime_error("Actor expected");*/
if (!cls.isActor())
throw std::runtime_error("Actor expected");
std::optional<osg::Matrix> boneTransform
= findBoneWorldTransform(o.ptr().getRefData().getBaseNode(), boneName);
@ -237,7 +236,7 @@ namespace MWLua
return static_cast<osg::Vec3f>(boneTransform.value().getTrans());
};
actor["getBoneRotation"] = [](const GObject& o, std::string_view boneName) -> sol::optional<osg::Quat> {
actor["getBoneRotation"] = [](const Object& o, std::string_view boneName) -> sol::optional<osg::Quat> {
const MWWorld::Class& cls = o.ptr().getClass();
if (!cls.isActor())
throw std::runtime_error("Actor expected");