playMaker

Author Topic: Setting parent affects scale  (Read 1779 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Setting parent affects scale
« on: March 02, 2014, 04:12:20 AM »
Odd problem I encountered, curious if it's a bug or some other issue -

I have a moving platform. When a character or movable cube touches it, the object becomes temporarily parented to the platform and moves with it.

If a cube touches the platform or falls onto it, all is well, working as intended (yay!). However, if the cube is at rest and the platform moves upward from below the cube (if the cube is resting on a ledge, for example), when the cube becomes parented to the platform, it instantly scales and becomes very skewed and odd. It scales further when leaving the platform (and becoming unparented from it).

I tried parenting the cube to an empty game object with default transforms (this empty game object is a child of the moving platform), but the problem persists. I know that ideally, objects should be moving into trigger colliders, not vice versa, so that could be my issue. But I'm curious if there's another reason for this odd inheriting of scale, and if there's a way to fix it!

:D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Setting parent affects scale
« Reply #1 on: March 03, 2014, 11:43:49 PM »
Hi,

 always try to keep all objects at scale 1,1,1, especially if they are physics, it does affect calculation performances and oddness.

 few links:

http://answers.unity3d.com/questions/147816/how-to-avoid-scaling-heritage-when-parenting.html
http://forum.unity3d.com/threads/61113-Parenting-without-scale


typically, if scaling is unavoidable, I would have empty gameobjects of scale one and only parent them objects together leaving the scaled meshes as childs of these empty gamobject.So you have a hierarchy that is always unscaled.

bye,

 Jean