#not slowing down

1 messages · Page 1 of 1 (latest)

uncut magnet
ocean ivy
#

Can you explain why are you using time.deltaTime?

uncut magnet
#

so it wont instantly stop

#

some fancy slow motioning to stopping

blissful inlet
#

@uncut magnet You need to manipulate your Slow variable, you are just subtracting from it, it will remain the same. And deltaTime is affected by scaling, use unscaledDeltaTime

uncut magnet
#

well overload :l

ocean ivy
#

Movetowards is a Vector3 function to move

#

Have you tried Mathf.Lerp?

uncut magnet
#

lerp?

ocean ivy
#

Yes

#

The documentation gives a bit of info

#

I can then explain for any doubts

uncut magnet
#

well still 3 floats... same as the movetowards...

ocean ivy
#

Mathf.Lerp

#

Not Vector3.Lerp

uncut magnet
#

i still cant understand it..

blissful inlet
#

Look at the usage in the manual

uncut magnet
#

ok

#

well

#

i cant understand it..

ocean ivy
#

We are here to help

#

@uncut magnet what’s your question

uncut magnet
#

is the timescale wokring if its more than 1 decimal?

ocean ivy
#

Probably

uncut magnet
#

its not working for me

#

i want smooth timescale 1 to 0

ocean ivy
#

How are you setting it?

uncut magnet
#

time.timescale = 1 - time.deltatime;

ocean ivy
#

Use the lerp

#

Well gtg

uncut magnet
#

i cant understand lerp

#

that's the problem

blissful inlet
#

This is just the same setup which I told you this about. Did you read it?

You need to manipulate your Slow variable, you are just subtracting from it, it will remain the same. And deltaTime is affected by scaling, use unscaledDeltaTime

uncut magnet
#

unscaleddeltatime?

blissful inlet
#

Anything you don't understand, put example into the code and see how it works

uncut magnet
blissful inlet
uncut magnet
#

exactly

#

0.1 0.2 0.3?

blissful inlet
#

Do you know what deltaTime does?

uncut magnet
#

yes

#

0.001, 0.002, 0.0003 etc

blissful inlet
#

no

uncut magnet
#

to 1

#

in 1 sec?

uncut magnet
blissful inlet
#

It's time between frames execution

uncut magnet
#

well... in beginner's language?

#

aaah

#

nvm

blissful inlet
#

So if you have constant 50 frames per second deltaTime will always be 0.02f

uncut magnet
#

but why its going up to 1?

blissful inlet
#

it's not

uncut magnet
#

ok...

#

weird

blissful inlet
#

and deltaTime is affected by scaling time

uncut magnet
#

ohh

blissful inlet
#

if you want value of time between frames unaffected by time scaling you use unscaledDeltaTime

uncut magnet
#

ok

#

still not working..

blissful inlet
#

So if you want to reduce scale you need variable that is set outside of the scope.

uncut magnet
#

i got an idea

blissful inlet
#

and reduce that variable using unscaled time then assign the variable

uncut magnet
#

how do i put to sleep without freezing the game?

blissful inlet
#

What are you trying to do?

uncut magnet
#

well

blissful inlet
#

manipulating timeScale only affects scripts and animations using deltaTime

uncut magnet
#

i wanted to make my own deltatime i know

blissful inlet
#

Again, if you don't know how something works. Use examples in your scripts and output values into console with debug messages or text element to see the result and understand

uncut magnet
#

i mean 0.1, 0.2, 0.3,..., 1 in 1 sec

blissful inlet
#

if you sum up deltaTime values during 1 second runtime, it will amount to 1 second.

uncut magnet
#

ok..

blissful inlet
#

if you set timeScale to 0.5f, it will take 2 seconds to get 1 second.

#

Test things, see how they work, then ask questions

uncut magnet
#

well

#

how do i put sleep without freezing?

blissful inlet
#

What do you mean by that, already asked you?

uncut magnet
#

i mean on .net u make new thead and use thread.sleep(ms)

#

so u wont freeze the whole program

blissful inlet
#

Unity has only one thread

uncut magnet
#

animation script thing

blissful inlet
#

If you want to use threading in Unity use Jobs system

uncut magnet
blissful inlet
#

You can only use threading on stuff that doesn't affect engine without it