0 I want to have a platform that begins to scale to (about) 0 in width and length once the player walks on top of it, but I want the player to have enough time to walk past this platform before it shrinks completely. Ignoring the code for the trigger event, how would I gradually scale this platform over some time interval t? more ▼ asked Mar 01 '10 at 10:54 PM John 1 3 ● 1 ● 1 ● 4 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

 0 ``````var startScale = Vector3.one; var endScale = Vector3.zero; var t = 0.0; var speed = .5; while (t < 1.0) { t += Time.deltaTime * speed; transform.localScale = Vector3.Lerp(startScale, endScale, t); yield; } `````` more ▼ answered Mar 01 '10 at 11:20 PM Eric5h5 81.5k ● 42 ● 133 ● 529 Hello there, this is interesting. would like to know more about this.I can understand the "var startscale" and var endscale" this set the saiz from size A to B correct. Would like to know why "var startscale" used "vector3.one" and "var endscale" used "vector3.zero", whay does is set like that? can both used "vector3.zero"?"var speed" is for the "time.deltatime" right, this is for he transtion speed on the "vector3.lerp" correct? but what is "var t"? and why is "t += time.deltaTime * speed" what does this line do actually?and using "while" will scale the gameobject to the desire size would it? do we need to used "while" to have smooth transtion of the gameobject or there's another method?in the "transform.localscale" why is there no "+" sign before the "=" sign?thanks in advance. Jan 11 '12 at 08:39 AM hizral84 Please don't dig up old posts to ask stupid questions. If you have basic programming questions to ask, go to google. If you have basic unity-specific questions to ask, use the search-bar at the top-right side of the page. If you still haven't found your answer, open up a new script file, and mess around a bit. If you still can't work out how it all fits together, or you run into a problem, then create a new question, and I'm sure somebody will be there to help you. Jan 11 '12 at 08:51 AM syclamoth lol        Jan 11 '12 at 08:52 AM Lo0NuhtiK Why yes, yes I am stupid. How did you know that. I did search google and used the search bar at the top right side of the page. I also did mess around a bit with the script. I did understand a bit, just would like to know more that is all. If the way I'm asking making you mad I apologize for that. But there's no harm done asking a question, tips, or guideance. Jan 12 '12 at 01:49 AM hizral84 Maybe no harm done, and Unity3D specific questions are more-than-welcome here, but this Q&A forum isn't intended to serve as a basic programming tutorial session. Tips etc is given quite frequently here, I've seen, but this isn't the place to 'ask' for them. Google should have yielded plenty of results for javascript. W3Schools.com <-there's one of the many places you can learn scripting/etc basics. I'm no expert, but I've learned every bit of the web-dev code and all other scripting that I know from w3schools, google searching, and a f**k-load of trial and error (as well as learning a lot here in unityAnswers in the passed month or so) So you can't tell me you can't find any information in an online search for the questions you posted. Jan 12 '12 at 02:05 AM Lo0NuhtiK add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 Please: Why does my instanced prefab appear with my final scale and doesn't do gradually?. I can't write the yield instruction because I'm in an Update function, maybe this is the problem...What would you do with it?. Thanks in adavance. more ▼ answered Apr 17 '12 at 07:03 AM jorgon 77 ● 26 ● 34 ● 35 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

By Email:

Topics:

x1332
x588
x401
x12
x7

asked: Mar 01 '10 at 10:54 PM

Seen: 2737 times

Last Updated: May 08 '12 at 10:30 PM