6
$\begingroup$

When I animate the iron sight and my gun separately, they kind of separate; the iron sights come off the gun (pictures below). What I want to do is join the objects together such that I could still move them separately (they would still be objects), but they would be able to be transformed together.

when moving the gun upwards  and rotating default position

$\endgroup$
2
$\begingroup$

You can Parent the object together.

From the wiki:

Moving and rotating the parent will also usually move/rotate the child/children. However moving/rotating the child/children of the parent will not result in the parent moving/rotating. In other words, influence is usually descendant (parent → child/children), and not ascendant (child/children → parent).

To parent one object to another, select them with the object you want to be the parent active (yellow) and press CtrlP.

For example:

  1. Select the sights, then select the main object last so it is the active object:

    enter image description here

  2. Press CtrlP> Object:

    enter image description here

Now the parented objects will have a dashed line drawn between them and the parent:

enter image description here

Moving the parent will move the child objects, but you will be able to move the child objects separately:

enter image description here

$\endgroup$
5
$\begingroup$

Parenting is the way to go, but then sometimes basic parenting can be too rigid, especially when animating. When permanent parenting gets in the way you can use a Child Of Constraint, which allows you to animate the influence that the parenting has.

In the following example the gun has 100% influence by the righthand while the lefthand has 0%. The yellow shading indicates that the influence value is keyframed so you can animate the influence to have the gun follow the lefhand at any given time. Within the game environment you could use python to turn the influence on and off.

For a game environment this can also help with different scenarios, eg pick up a bayonet and clip it to the barrel, then unclip it for hand to hand combat, pick up a silencer and clip that on, then turn off the parenting to leave it behind.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.