engine/gamesys/src/gamesys/scripts/script_spine_model.cpp
/*# set the target position of an IK constraint object
     *
     * Sets a static (vector3) target position of an inverse kinematic (IK) object.
     *
     * @name spine.set_ik_target_position
     * @param url [type:string|hash|url] the spine model containing the object
     * @param ik_constraint_id [type:string|hash] id of the corresponding IK constraint object
     * @param position [type:vector3] target position
     * @examples
     *
     * The following example assumes that the spine model has id "spinemodel".
     *
     * How to set the target IK position of the right_hand_constraint constraint object of the player object
     *
     * ```lua
     * function init(self)
     *   local pos = vmath.vector3(1, 2, 3)
     *   spine.set_ik_target_position("player#spinemodel", "right_hand_constraint", pos)
     * end
     * ```
     */
set the target position of an IK constraint object
Sets a static (vector3) target position of an inverse kinematic (IK) object.



The following example assumes that the spine model has id "spinemodel".




set the target position of an IK constraint object Sets a static ( vector3 ) target position of an inverse kinematic ( IK ) object . The following example assumes that the spine model has id " spinemodel " .
int SpineComp_SetIKTargetPosition(lua_State* L)
    {
        int top = lua_gettop(L);
        dmGameObject::HInstance sender_instance = CheckGoInstance(L);
        dmGameObject::HCollection collection = dmGameObject::GetCollection(sender_instance);
        uintptr_t user_data;
        dmMessage::URL receiver;
        SpineModelWorld* world = 0;
        dmGameObject::GetComponentUserDataFromLua(L, 1, collection, SPINE_MODEL_EXT, &user_data, &receiver, (void**) &world);
        SpineModelComponent* component = world->m_Components.Get(user_data);
        dmhash_t ik_constraint_id = dmScript::CheckHashOrString(L, 2);
        Vectormath::Aos::Vector3* position = dmScript::CheckVector3(L, 3);
        if (!CompSpineModelSetIKTargetPosition(component, ik_constraint_id, 1.0f, (Point3)*position))
        {
            return luaL_error(L, "the IK constraint target '%s' could not be found", lua_tostring(L, 2));
        }
        assert(top == lua_gettop(L));
        return 0;
    }
int SpineComp_SetIKTargetPosition ( lua_State * L ) { int top = lua_gettop ( L ) ; dmGameObject :: HInstance sender_instance = CheckGoInstance ( L ) ; dmGameObject :: HCollection collection = dmGameObject :: GetCollection ( sender_instance ) ; uintptr_t user_data ; dmMessage :: URL receiver ; SpineModelWorld * world = 0 ; dmGameObject :: GetComponentUserDataFromLua ( L , 1 , collection , SPINE_MODEL_EXT , & user_data , & receiver , ( void * * ) & world ) ; SpineModelComponent * component = world -> m_Components . Get ( user_data ) ; dmhash_t ik_constraint_id = dmScript :: CheckHashOrString ( L , 2 ) ; Vectormath :: Aos :: Vector3 * position = dmScript :: CheckVector3 ( L , 3 ) ; if ( ! CompSpineModelSetIKTargetPosition ( component , ik_constraint_id , 1.0f , ( Point3 ) * position ) ) { return luaL_error ( L , " " , lua_tostring ( L , 2 ) ) ; } assert ( top == lua_gettop ( L ) ) ; return 0 ; }
set the target position of an IK constraint object
 Sets a static (vector3) target position of an inverse kinematic (IK) object.
set the target position of an IK constraint object Sets a static ( vector3 ) target position of an inverse kinematic ( IK ) object .