physics PickDrag lua binding
This commit is contained in:
@@ -1700,3 +1700,10 @@ Playstation button codes:
|
||||
- [outer]ACTIVATION_STATE_INACTIVE : int
|
||||
|
||||
- Intersects(Scene scene, Ray ray) : Entity entity, Vector position,normal, Entity humanoid_ragdoll_entity, HumanoidBone humanoid_bone, Vector position_local -- Performns physics scene intersection for closest hit with a ray
|
||||
|
||||
- PickDrag(Scene scene, Ray, ray, PickDragOperation op) -- pick and drag physics objects such as ragdolls and rigid bodies.
|
||||
|
||||
#### PickDragOperation
|
||||
Tracks a physics pick drag operation. Use it with `phyiscs.PickDrag()` function. When using this object first time to PickDrag, the operation will be started and the operation will end when you call Finish() or when the object is destroyed
|
||||
- [constructor]PickDragOperation() -- creates the object
|
||||
- Finish() -- finish the operation, puts down the physics object
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace wi::lua
|
||||
lunamethod(Physics_BindLua, ApplyTorqueImpulse),
|
||||
lunamethod(Physics_BindLua, SetActivationState),
|
||||
lunamethod(Physics_BindLua, Intersects),
|
||||
lunamethod(Physics_BindLua, PickDrag),
|
||||
{ NULL, NULL }
|
||||
};
|
||||
Luna<Physics_BindLua>::PropertyType Physics_BindLua::properties[] = {
|
||||
@@ -423,6 +424,36 @@ namespace wi::lua
|
||||
wi::lua::SError(L, "Intersects(Scene, Ray) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
int Physics_BindLua::PickDrag(lua_State* L)
|
||||
{
|
||||
int argc = wi::lua::SGetArgCount(L);
|
||||
if (argc > 2)
|
||||
{
|
||||
scene::Scene_BindLua* scene = Luna<scene::Scene_BindLua>::lightcheck(L, 1);
|
||||
if (scene == nullptr)
|
||||
{
|
||||
wi::lua::SError(L, "Intersects(Scene, Ray, PickDragOperation) first argument is not a Scene!");
|
||||
return 0;
|
||||
}
|
||||
primitive::Ray_BindLua* ray = Luna<primitive::Ray_BindLua>::lightcheck(L, 2);
|
||||
if (ray == nullptr)
|
||||
{
|
||||
wi::lua::SError(L, "Intersects(Scene, Ray, PickDragOperation) second argument is not a Ray!");
|
||||
return 0;
|
||||
}
|
||||
PickDragOperation_BindLua* op = Luna<PickDragOperation_BindLua>::lightcheck(L, 3);
|
||||
if (op == nullptr)
|
||||
{
|
||||
wi::lua::SError(L, "Intersects(Scene, Ray, PickDragOperation) third argument is not a PickDragOperation!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
wi::physics::PickDrag(*scene->scene, ray->ray, op->op);
|
||||
return 0;
|
||||
}
|
||||
wi::lua::SError(L, "Intersects(Scene, Ray, PickDragOperation) not enough arguments!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Physics_BindLua::Bind()
|
||||
{
|
||||
@@ -430,6 +461,7 @@ namespace wi::lua
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
Luna<PickDragOperation_BindLua>::Register(wi::lua::GetLuaState());
|
||||
Luna<Physics_BindLua>::Register(wi::lua::GetLuaState());
|
||||
Luna<Physics_BindLua>::push_global(wi::lua::GetLuaState(), "physics");
|
||||
|
||||
@@ -439,4 +471,21 @@ ACTIVATION_STATE_INACTIVE = 1
|
||||
)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Luna<PickDragOperation_BindLua>::FunctionType PickDragOperation_BindLua::methods[] = {
|
||||
lunamethod(PickDragOperation_BindLua, Finish),
|
||||
{ NULL, NULL }
|
||||
};
|
||||
Luna<PickDragOperation_BindLua>::PropertyType PickDragOperation_BindLua::properties[] = {
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
int PickDragOperation_BindLua::Finish(lua_State* L)
|
||||
{
|
||||
op = {};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,22 @@ namespace wi::lua
|
||||
int SetActivationState(lua_State* L);
|
||||
|
||||
int Intersects(lua_State* L);
|
||||
int PickDrag(lua_State* L);
|
||||
|
||||
static void Bind();
|
||||
};
|
||||
|
||||
class PickDragOperation_BindLua
|
||||
{
|
||||
public:
|
||||
wi::physics::PickDragOperation op;
|
||||
inline static constexpr char className[] = "PickDragOperation";
|
||||
static Luna<PickDragOperation_BindLua>::FunctionType methods[];
|
||||
static Luna<PickDragOperation_BindLua>::PropertyType properties[];
|
||||
|
||||
PickDragOperation_BindLua() = default;
|
||||
PickDragOperation_BindLua(lua_State* L) {}
|
||||
|
||||
int Finish(lua_State* L);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 330;
|
||||
const int revision = 331;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user