x


Stop transforming child object

i m having a camera attached to some game object . i want to stop camera transformation when the parent object moves . how can i do that ?

more ▼

asked Jul 19 '12 at 09:27 AM

Humb gravatar image

Humb
36 9 21 25

So basically, you want your camera to be parented but not parented at the same time???

Jul 19 '12 at 12:04 PM Kryptos
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Hi Humb,

childs are always transformed with their parent. That is pretty much the only reason for the existance of such a scenegraph mechanism.

If you do not want to unparent it completely, you have some choices

  1. Unparent the camera temporary and stick it back after the cutscene or whatever you wanna do with the camera. (simple)
  2. Calculate the transform of the camera inverse to the transform of the Object in the Update Function of Script applied to the camera. (harder)
  3. Unparent the camera completely and let it follow the object in World coordinates. (harder)
  4. Use a second camera that is no child of the Object and switch to this one. (simple)
more ▼

answered Jul 19 '12 at 02:15 PM

Nightwatch gravatar image

Nightwatch
31 1

(comments are locked)
10|3000 characters needed characters left

Unparent it

EDIT: I guess you could just set the child's transform directly by capturing the target transform.position when you want it to stay put, then in the Update on the camera:

transform.position = targetPosition;

more ▼

answered Jul 19 '12 at 09:30 AM

Seth Bergman gravatar image

Seth Bergman
7k 10 16 28

without doing that

Jul 19 '12 at 09:33 AM Humb
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x426
x413
x12

asked: Jul 19 '12 at 09:27 AM

Seen: 404 times

Last Updated: Jul 19 '12 at 02:15 PM