playMaker

Author Topic: Scaling an object  (Read 1918 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Scaling an object
« on: June 22, 2014, 05:29:31 AM »
Hi!
Is it a way to scale an object in for example horizontal axis, but only one side?
To be more specific. I want to scale an object, but the left side of the object will be freezed, so it's only scaling the right side.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Scaling an object
« Reply #1 on: June 22, 2014, 06:30:24 PM »
Scaling happens from the objects origin or local 0,0,0. So if you parented an object to an empty and placed the object so the empty's world position was to the left or right (anywhere really) of your object you could scale the child object by using the  parent empty's scale in any direction you want with any center point.

This wouldn't work great with any model but suppose you wanted to use the built in polygon plane as a health bar. You could parent it to an empty and place the empty to the left most point of the poly. Now when you scale to in the x axis positively it would expand or contract from the left.

Depending on what you need you might have to design and model your object to work correctly. You may need to have two models that create one object when placed side by side.
« Last Edit: June 22, 2014, 06:41:26 PM by redikann »

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Scaling an object
« Reply #2 on: June 23, 2014, 04:56:59 PM »
Hi!
Thanks for the answer.

I was thinking how to make a simple snake game. So when the snake eat an apple, I scale the snake one pixel or something.
How do you think of this way? I could maybe add one cube on the snake everytime it eat an apple, but I want it to be smooth. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no