Okay now it works. But it shrinks to fast, i would like it to be about 30 seconds to shrink. And then shrink in to (3, 1, 3,) I am sorry if i seem to be ungrateful of your help and just seem like your were nothing, that is not what i mean. I my intension was to ask if you could help me something more, not to say that your job was not done well enough :). EDIT: "It shrinks too fast."
CharacterController through the Move method [Players]
RigidBody through AddForce or velocity[Physics]
Any Transform through the transform.position[Custom]
You call those methods in different ways:
The Update, FixedUpdate or LateUpdate methods [Monobehaviour] which are called every frame or fixed frames
Coroutines
You should choose one method and a way dependig on your needs
Coroutines work this way:
private IEnumerator Cor_Something(Transform source, Transform target)
{
bool MovementDone = false
while (MovementDone)
{
Move()
if (Distance(target, source) <= MinDistance)
MovementDone = true;
yield return new WaitForSeconds(n)/WaitForEndOfFrame()/WaitForFixedUpdate/etc
}
}
You should NOT Instanciate your Coroutine inside your coroutine like you did !
Hello there, No worries, it's perfectly all right to ask. In this case, the shrink already works based on the "duration" parameter. All you need to do is call ScaleToTarget(new Vector3(3.0f, 1.0f, 3.0f), duration);, and replace "duration" with the time you want the process to take in seconds. In my example above I set it to 2.5 seconds, but you could just as easily give it 50. Hope that helps! ~LegendBacon
i think find the answer after watching this video:
we can use Courotine for moving objects by a while loop.(See the following code) “yield return null;” means that Courotine will resume after the next update as a result content of while loop executed once per frame.
You wait for 0 seconds? why? and why do you stop ALL the coroutines afterwards?
– EpiFoulouxOkay now it works. But it shrinks to fast, i would like it to be about 30 seconds to shrink. And then shrink in to (3, 1, 3,) I am sorry if i seem to be ungrateful of your help and just seem like your were nothing, that is not what i mean. I my intension was to ask if you could help me something more, not to say that your job was not done well enough :). EDIT: "It shrinks too fast."
– RoervigPruductins