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

Moderators
  • Content Count

    2,802
  • Joined

  • Last visited

  • Days Won

    152

Everything posted by geckoo

  1. geckoo

    SuperHot FX

    A small script to create a physical effect similar to the game SuperHot. 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 ++ // ---------------------- variables var curTimeScale : float; var maxTimeScale : float = 1.0; var minTimeScale : float = 0.1; var AxisOnTTSMax : float = 2.0; var fovMax : float = 63.0; // ---------------------- function Update() { // we cannot be unless 0.1 if (Time.timeScale < minTimeScale) Time.timeScale = minTimeScale; else{ Time.timeScale = Mathf.Lerp(SuperHotFX(), curTimeScale, minTimeScale); if (Camera.main.fieldOfView >= fovMax) Camera.main.fieldOfView = fovMax; } // mouse axis increase Time.timeScale ++ if(Input.GetAxis ("Mouse X") != 0.0 || Input.GetAxis ("Mouse Y") != 0.0){ Time.timeScale = Time.timeScale + maxTimeScale / AxisOnTTSMax; } // we cannot increase Time.timeScale more than 1.0 if (Time.timeScale > maxTimeScale) Time.timeScale = maxTimeScale; SlowMotionSound(); FXfov(); } // Time.timeScale is calculated by the velocity function SuperHotFX () { var controller : CharacterController = GetComponent(CharacterController); var overallVelocity : Vector3 = controller.velocity; overallVelocity = Vector3(controller.velocity.x, controller.velocity.y, controller.velocity.z) / maxTimeScale; var overallSpeed : float = overallVelocity.magnitude; if (overallSpeed > maxTimeScale) return maxTimeScale; else return overallSpeed; } function FXfov() { // smoothy fov Camera.main.fieldOfView = Camera.main.fieldOfView + (Mathf.Lerp(SuperHotFX(), curTimeScale, .1) * .5); } // all sounds are affected by the Time.timeScale function SlowMotionSound() { var aSources = FindObjectsOfType(AudioSource); for (aSource in aSources) aSource.pitch = Mathf.Lerp(SuperHotFX(), curTimeScale, .1) + .2; }
  2. I tried this alternative, but curiously, despite the logic, the pitch of the background music is always defined by Time.timeScale. // all sounds are affected by the Time.timeScale // but i want keep only one music with a constant Time.timeScale 1.0 function SlowMotionSound() { var aSources = FindObjectsOfType(AudioSource); for (aSource in aSources) if (aSource.name != Track.name) aSource.pitch = Mathf.Lerp(SuperHotFX(), curTimeScale, .1) + .2; else aSource.pitch = 1.0; } I don't understand how i can fix this problem. Thank you for help ++
  3. Again an answer. How create an exception in a loop "for" ? Thx for help ++ // all sounds are affected by the Time.timeScale // but i want keep only one music with a constant Time.timeScale 1.0 function SlowMotionSound() { var aSources = FindObjectsOfType(AudioSource); for (aSource in aSources) // if (aSource.name == ThisString) aSource.pitch = 1.0; <<<< aSource.pitch = Mathf.Lerp(SuperHotFX(), curTimeScale, .1) + .2; }
  4. Hum now i understand. I must attach it on the sound file. It's so easy... I'll try. Thx спаситель мой
  5. Извини меня друг мой, я не мог объяснить точно на английском языке свою проблему. Я хочу независимо от Time.timeScale сохранить для одной музыки audio.pitch = 1.0. Остальные звуки изменяются когда я двигаюсь. Понял ли ты ? человек двигается - Time.timeScale = 1.0 and audio.pitch = 1.0 человек не двигается - Time.timeScale = 0.1 но я хочу ещё audio.pitch = 1.0 (just for one ambiant music) // ---------------------- variables var Track : AudioClip; // if you want a background sound var curTimeScale : float; var maxTimeScale = 1.0; var minTimeScale = 0.1; var AxisOnTTSMax = 2.0; var fovMax = 63; // ---------------------- function Update() { // we cannot increase Time.timeScale +1.0 if (Time.timeScale < minTimeScale) Time.timeScale = minTimeScale; else{ Time.timeScale = Mathf.Lerp(SuperHotFX(), curTimeScale, minTimeScale); if (Camera.main.fieldOfView >= fovMax) Camera.main.fieldOfView = fovMax; } // mouse axis increase Time.timeScale ++ if(Input.GetAxis ("Mouse X") != 0.0 || Input.GetAxis ("Mouse Y") != 0.0){ Time.timeScale = Time.timeScale + maxTimeScale / AxisOnTTSMax; } SlowMotionSound(); FXfov(); } // Time.timeScale is calculated by the velocity function SuperHotFX () { var controller : CharacterController = GetComponent(CharacterController); var overallVelocity : Vector3 = controller.velocity; overallVelocity = Vector3(controller.velocity.x, controller.velocity.y, controller.velocity.z) / maxTimeScale; var overallSpeed : float = overallVelocity.magnitude; if (overallSpeed > maxTimeScale) return maxTimeScale; else return overallSpeed; } function FXfov() { // smoothy fov Camera.main.fieldOfView = Camera.main.fieldOfView + (Mathf.Lerp(SuperHotFX(), curTimeScale, .1) * .8); } // all sounds are affected by the Time.timeScale function SlowMotionSound() { var aSources = FindObjectsOfType(AudioSource); for (aSource in aSources) { aSource.pitch = Mathf.Lerp(SuperHotFX(), curTimeScale, .1) + .12; } } // for an eventually background music/sound function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) { var go = new GameObject ("One shot audio"); go.transform.position = position; var source : AudioSource = go.AddComponent (AudioSource); source.clip = clip; // source.Priority = 0.0; // priority source.volume = volume; source.pitch = 1.0; source.Play (); Destroy (go, clip.length); return source; } Хочу независимо от всего всегда слышать только одну музыку с Time.timeScale = 1.0 and audio.pitch = 1.0
  6. In a program I use controller.velocity to change the variable Time.timeScale (see for example SuperHot game). The code works well. The sounds are changed and the effect makes a good slide. I have another problem. I try desperately to keep one track (background music) with a Time.timeScale equal to 1. I can not maintain its independence. It is inevitably influenced by the general Time.timeScale. Is there a way around this obstacle? I tried using a static variable, but it does not work. Thank you very much for your help + +
  7. Best way is pretty simple : Create a FPS player using the first camera. Create a second camera like in tuto with minimap - smoothfollow (you can find it on the web). Use a transition script when you press a key... Here you can find many scripts to understand JV - it's a good lesson ++ http://wiki.unity3d.com/index.php?title=Scripts
  8. geckoo

    Time.timeScale

    Молодец !!! Ещё раз ты помогал мне браток. Огромное спасибо тебе ++
  9. geckoo

    Time.timeScale

    Again i got an answer. How i can affect the Time.timeScale using the mouse - button and axis ? I search a code or an explanation about this function but nothing i found. Have you some idea ?
  10. geckoo

    Time.timeScale

    I found the solution to keep a fluid animation like in SuperHot game. Must change some values on board "Edit / Project Settings / Time" Fixed Timespeed 0.02 to 0.006. It's work fine ++
  11. geckoo

    Time.timeScale

    I found a solution with your help, and it works pretty well, but I have another problem with the animations, which remain at 24 fps per second. As a result, there is a jerk when Time.timeScale is ten times lower. How to solve this problem to gain fluency. Thank you to you + + var curTimeScale : float; var maxMoveSpeed = 1.0; function Update(){ if (Time.timeScale < .1) Time.timeScale = .1; else Time.timeScale = Mathf.Lerp(SuperHotFX(), curTimeScale, .1); } function SuperHotFX (){ var controller : CharacterController = GetComponent(CharacterController); var overallVelocity : Vector3 = controller.velocity; overallVelocity = Vector3(controller.velocity.x, controller.velocity.y, controller.velocity.z) / maxMoveSpeed; var overallSpeed : float = overallVelocity.magnitude; if (overallSpeed > maxMoveSpeed) return maxMoveSpeed; else return overallSpeed; }
  12. geckoo

    Time.timeScale

    Thx OcularCash. I understand idea. I'll try it today ++
  13. It's an alpha. We must wait. Graphics are very simple, but it's an interesting style and concept. I think it's not a pure FPS, but only a puzzle/platform game like the amazing Portal. I like playing with the time. If they can find the money through GreenLigth, finally this game will be a indy bomb ++
  14. geckoo

    Time.timeScale

    Interesting. Thx ++ Do you have some code - a little example to understand please? Thx boys ++
  15. geckoo

    Time.timeScale

    I was very impressed by the game superhot and I looked for a similar code to associate with player movement a time variation. I tried different methods with Time.timeScale, but the result is not very smooth. I joined the slow motion script like in FPSKit. It's work, but result not really fine. Do you have any idea about the principle or you have known a similar code? Thank you for your help + + // simply example with forward movement function Update(){ if (Input.GetKeyDown (KeyCode.W)) Time.timeScale = 1.0; if (Input.GetKeyUp (KeyCode.W)) { Time.timeScale = 0.1; Time.fixedDeltaTime = 0.02 * Time.timeScale; } }
  16. You can find a really good example in the Tutorial_FPS to create an interesting turret. Compare your work with this original script. It's very usefull. Thx for sharing ++
  17. Yes. SuperHot is not very explicite. They must find another name... but it's not a problem. How many games changes his name during creation ?
  18. Really interesting. Very addictive. It's built with Unity?
  19. geckoo

    BF4 on PS3?

    IT WORKS ! Look this map Dude - china rising. It's great
  20. Thank you for this information. What do you think about this tool? I tried with Animeeple, but I didn't like. I don't know much about entertainment, and that is why I was looking for an alternative. I will try it ++
  21. geckoo

    BF4 on PS3?

    Hum... nearly all platforms, you said... I got a ZX81 (my first computer). It works?
  22. geckoo

    BF4 on PS3?

    A simple question. It seemed that BF4 would come out on PC, XboxOne and PS4. But on amazon, it also provides for PS3. Is this possible?
  23. geckoo

    Horror help!

    Yes. I made a mistake in terms, but I think he understands the explanation exposed. Trigger or triggered are for me a generic term for the same result in this case... You're right. We must differentiate functions ++
  24. geckoo

    Horror help!

    You can use a simple trigger and when the player passes through - nearly door, a script will change XYZ of the mobile part, but the easiest way is to make a door closing or opening animation and play it by script when triggered ( use OnCollisionEnter and animation.Play() ). Where's the problem ? Can you explain plz ? In FPSkit 1.3.5, you will find an example, a code to use trigger OnCollisionEnter (monster's instantiation) ++
×
×
  • Create New...