Anim8or Community

General Category => General Anim8or Forum => Topic started by: bayinghound on April 04, 2020, 10:28:13 am

Title: Attaching object or a target to a bone
Post by: bayinghound on April 04, 2020, 10:28:13 am
Is there a way to attach and object to a bone in a scene. I was playing around with targets but that came up empty.

What I'm trying to do is animate a figure with a gun. I wanted to attach the "laser fire" to the muzzle of the gun.

Does that make sense?
Title: Re: Attaching object or a target to a bone
Post by: Steve on April 04, 2020, 01:00:44 pm
There isn't any way to do this currently. It's a very good idea and I've thought about it quite a bit. I should just dive in and see what I can do!
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 04, 2020, 06:11:30 pm
That would be awesome!
Title: Re: Attaching object or a target to a bone
Post by: ENSONIQ5 on April 05, 2020, 02:33:33 am
There are a couple of sneaky workarounds that may give the effect you're after, if I understand correctly what you are trying to do.  One way would be to use morphs to effectively hide and reveal objects in scene mode.  So, the laser beam would be assigned to a bone in the figure, such as a hand bone, with a morph target set on the beam that changes the length of the beam.  So the beam is hidden in the barrel of the gun, then extended in a single frame when needed.  This is a rough example using an old model:

Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 05, 2020, 05:59:32 am
There are a couple of sneaky workarounds that may give the effect you're after, if I understand correctly what you are trying to do.  One way would be to use morphs to effectively hide and reveal objects in scene mode.  So, the laser beam would be assigned to a bone in the figure, such as a hand bone, with a morph target set on the beam that changes the length of the beam.  So the beam is hidden in the barrel of the gun, then extended in a single frame when needed.  This is a rough example using an old model:



I tried a slightly different approach with not nearly the results you got. I hadn't thought of using morph targets or a solid beam. Thanks for the tip! I'll try that out.
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 06, 2020, 04:54:50 pm
I'm trying to wrap my head around how to use the morph targets for the laser beam. For some reason I can't get it to work
Title: Re: Attaching object or a target to a bone
Post by: ENSONIQ5 on April 07, 2020, 02:59:07 am
Do you mean setting the morph target in Object mode, or accessing the morph channel in Scene mode?
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 07, 2020, 07:51:06 am
Yes. Use a morph in scene mode.
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 07, 2020, 07:53:02 am
My other option, I guess is to put the laser fire on a different layer with a green background and render it seperately then add it in my video editing software.
Title: Re: Attaching object or a target to a bone
Post by: AlecJames on April 07, 2020, 09:36:08 am
I just tried what ESONIQ5 suggested and it seemed to work OK

Is this what you are trying to achieve? 

Title: Re: Attaching object or a target to a bone
Post by: ENSONIQ5 on April 07, 2020, 09:50:37 am
The morph target should be visible in Scene mode as a channel, though if the motion is being driven by a sequence it might be necessary to convert the sequence to frames first (but I could be wrong, I wasn't paying attention when I did the test!).  From memory this can be done by adding a keyframe to any channel in the sequence, a dialog will ask if you want to convert the sequence to frames.  Then just change the morph channel's value from 0 (no morph) to 1 (morphed) to extend and retract the beam.
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 07, 2020, 11:48:19 am
I just tried what ESONIQ5 suggested and it seemed to work OK
 
Is this what you are trying to achieve? 



More or less. I'll play around with it. Thanks
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 08, 2020, 07:46:00 am
I was trying to do some recoil.
Title: Re: Attaching object or a target to a bone
Post by: AlecJames on April 09, 2020, 10:43:42 am
the laser isn't recoiling with the gun.  What is the parent of the laser?  Or did you intend the gun to recoil and the laser to be stable?

Might look cool if the laser is facing other - a target, has the gun as its parent, so as the gun recoils the laser stays dead on target.

(I know the physics of a laser will not cause recoil, but it looks good  :) ) 
Title: Re: Attaching object or a target to a bone
Post by: bayinghound on April 09, 2020, 11:47:14 am
The gun is part of a figure. I made the laser a child of the figure. I couldn't make a bone a parent, which would have been awesome.