Is it possible to reset position of Empty object associated to Hook modifier?

Hello.

I’m trying to reset the position of the Empty objects associated to the Hook modifier. This is not possible, since when you press alt + g the empty goes to the origin on the scene.

I have seen that at some point there was a path for this that was incorporated already:

But I can’t find the way to do it.

While using the option of the hook modifier to RESET, the vertex resets it’s position, but not the Empty.

I have tried also to use a cube instated of an empty on the hook. Here I can apply the location and rotation of the cube, so the local position stays even if the origin is in the center of the scene. Like this you can grab the cube around and reset to the original position with alt + g. This works fine for the location but not for the rotation, since it happens from the center of the scene.

It would be grate if anyone can help me with this.

Thanks so much.

In the link that you provide is already the solution. Use Bones instead of objects or emptys.

Oi Carolina,

have you tried to set the cube as a parent of the empty and then apply the transformations to the empty by pressing Ctrl+A?

I did try with bones, but it doesn’t work, since to be able to reset position in a bone you have to be in pose mode. To be able to hook anything to a mesh you have to be in object mode.

If you move the bone in pose mode doesn’t hook the mesh. If you move the bone in object mode, you can’t reset it’s position. If you try to do it, happens the same as with the cube. Goes to origin of the scene.




I did try, but happens the same. The Empty resets it’s position to the center of the scene.

here’s a fix:

import bpy
from mathutils import Vector

def HookReset(object, hook):
    for m in object.modifiers:
        if m.object==hook:
            P=Vector([m.center[0],m.center[1],m.center[2]])
            hook.location=P
            
            
class HookResetOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.hook_reset"
    bl_label = "Reset Hooks Object Location"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None and len(context.selected_objects)==2

    def execute(self, context):
        ob=context.active_object
        hk=[obj for obj in context.selected_objects if obj != ob]
        print(hk)
        HookReset(ob, hk[0])
        return {'FINISHED'}


def register():
    bpy.utils.register_class(HookResetOperator)


def unregister():
    bpy.utils.unregister_class(HookResetOperator)


if __name__ == "__main__":
    register()

and here’s how to use it:
in blender, open the text editor, create a new text and paste this code in it.
in the menu, check the ‘register’ check box and click ‘run’

select your empty (or whatever object you have for hook)
shift+select the object with the modifier
press ‘SPACE’ and look for ‘reset hooks object location’
done

:wink:

Are u sure? if i hook a bone to vertecies it works without any problem …my stepts to create a hook modifier on a mesh controlled by a bone is as followed.

  1. select the bone in pose mode
  2. shift+select the object
  3. tab to go in edit mode…select vertecies that you want hook.
  4. ctrl.+h hook to bone.

after that you can use additional vertex group to define the vertex weight influence.

Select the bone that will be used as the hook in Pose mode. Make sure it is at it’s rest position (ATL G, R and S to reset transforms) and placed appropriately. Edit the rest position of the bone in edit mode of the armature if not, then reselect the bone in pose mode.

Next, select the mesh while holding shift. Tab into Edit mode of the mesh and select the vertices you’d like to hook to the bone. With the selection complete, CTRL H, Hook to Object Bone.


Good luck!

Edit: Looks like VANDERHORST got here before I did.

Thank you very much.

With the advice of VANDERHORST and DanPro it’s working.

I was doing it wrong. Not in pose mode and not with Hook to Selected Object Bone, but just selected object.

Secrop, I’ve tried the script, thank you, but also, the reset position was taking the Empty to a wrong position.