x


Variable for transform position y?

Edit: My script was actually correct. I just had to adjust the number.


Hello,

I have a script for creating campfires. However, I only want the "canBuild" boolean to be true if the character is on the ground. This is because at the moment, if you stand on top of a campfire and you make another campfire, the new campfire will be floating in the air. If you continue like this, you can make a staircase of campfires.

So I tried something like this:

if (transform.position.y > 5.3){
            canBuild = false;
        }

However, while playing the game, I notice that the Transform Positions don't update as you move around.

Any help is appreciated.

more ▼

asked Aug 03 '10 at 06:42 PM

MythStrott gravatar image

MythStrott
176 22 23 31

Transform does update. You've probably got the script on the wrong object.

Aug 03 '10 at 08:09 PM spinaljack

It turns out that it was working fine. I just had the number (5.3) set way too high. It's working good now. Thanks for the comment though

Aug 05 '10 at 02:25 AM MythStrott
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x1330
x915
x44
x35
x28

asked: Aug 03 '10 at 06:42 PM

Seen: 2198 times

Last Updated: Aug 05 '10 at 04:12 PM