x


How do I shrink a cube with scripts?

I'm making a 2D game and a character needs to crouch. The material Sets to a picture of someone crouching, but the box stays the same size. How do I make it shrink to the size of the image file of the texture? If imposible, how else can i make a 2d character made from one shape crouch?

more ▼

asked Jul 24 '11 at 08:14 AM

magicaxis gravatar image

magicaxis
16 3 3 4

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

1 answer: sort voted first

Take a look at transform

You would need to adjust the value using the localscale property of the transform. i.e

transform.localScale.y = 0.5;
more ▼

answered Jul 24 '11 at 08:19 AM

Meltdown gravatar image

Meltdown
5.6k 18 25 49

Doesn't appear to work :(

Jul 24 '11 at 09:04 AM magicaxis

I had to do this, and it didnt work :(

Vector3 temp = new Vector3(1.0f, 0.5f, 1.0f); transform.localScale.Scale(temp);

Jul 24 '11 at 09:05 AM magicaxis
(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:

x819
x389
x355
x290
x258

asked: Jul 24 '11 at 08:14 AM

Seen: 1132 times

Last Updated: Jul 24 '11 at 09:05 AM