Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

geckoo

SuperHot FX

Recommended Posts

A small script to create a physical effect similar to the game Please login or register to see this link. . Velocity of movement sets the variable Time.timeScale and affects animations and sounds in the game. Time.timeScale oscillates between 0.1 and 1.0 and the mouse create a small slide. This script works fine with the FPS_Tutorial. I hope you like this...

 

A special thanks to those who helped me during the development ++

Please login or register to see this code.

Share this post


Link to post
Share on other sites

Yeah? Explain to me. Plz :)

How can i reduce this problem?

Share this post


Link to post
Share on other sites

matter of opinion. Nothing wrong with his code just his style, its fine the 'scale' that this would effect performance is very very small.

  • Like 1

Share this post


Link to post
Share on other sites

In this case your so wrong conner, this is not a style, its a matter of optimising your code, dynamic variables can be anything, string, float, int and even the optimisation page (not graphic optimisation) says that this is bad

Share this post


Link to post
Share on other sites

I understand your point of view Mars2011 and you're right. I need some help. Thx.

If you see another mistake, say it. I wanna know how increase my understanding for develop in JS.

Don't forget i am a beginner ++

Share this post


Link to post
Share on other sites

sorry, I have completely misread everything :s I read it as dont use static variables... which, well... yeah :P      yeah dont use dynamic variables :P  sorry mars xd

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, make sure that you assign a type to the variable and not make Unity guess for you. C# kinda forces you to assign a type for variables I think.

Share this post


Link to post
Share on other sites

Another advice:

this is wrong:

Please login or register to see this code.

Your handling the int like a float 2.0.

either write float instead of int or remove the .0

Share this post


Link to post
Share on other sites

Thank you for this correction. I corrected ++

Share this post


Link to post
Share on other sites

Wait what? Am I just really stupid (I probably am) because the script simply does not work. The very 1st line has an error. The console does not recognize 'var'. Wtf?

Share this post


Link to post
Share on other sites

It works fine. Where is the problem?

Share this post


Link to post
Share on other sites

For those who had some problem so as to use this script, we can summarize it by a few lines which explain all about these strange mechanics. Time.timeScale is a value which defines the time when 0 is null and 1 something which can be easily compared with our real perception of time - maybe reality if I should be explicite. By linking this value with the player's magnitude, we can create some mechanics which are similar with the SuperHot gameplay. When you move, the time flows - and when you stop, also the time is freezed. However, we MUST use another time command so as to keep a smooth slow motion for all object - Time.fixedDeltaTime. Finally, it's not too hard to understand. Basically take your player controller (which embeds a rigidbody) and adjust these lines in Update () section. No more. Tested and approved :
 

Please login or register to see this code.

I forget to say to you that Time.timeScale affects all physics. If you want apply a force on another RigidBody, you must again interacts with objects by using Time.fixedDeltaTime.

Don't use a simple float number or an integer because Time.timeScale will ruin the previous physics. I give you an example which is taken on my previous script Please login or register to see this link. :
 

Please login or register to see this code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...