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.

Johannes

Member
  • Content Count

    684
  • Joined

  • Last visited

  • Days Won

    25

Everything posted by Johannes

  1. Johannes

    WARZONE!

    This looks awesome exited to see what you'll come up with. If I may just give my opinion , for this project to be successful I believe you'll need a never before seen , innovative game mode and as always I think extremely detailed visual fidelity will lead to success. Great work so far!
  2. Using animation to make the gun move on movement is extremely expensive and unnecessary and frankly allot of work. I altered one of the scripts I found on this forum to achieve what I think you need , here you go : This is added to the Gun to move on reaction to the player : var smooth : float = 2; var tiltAngle : float = 15; function Update () { var Tilt = Input.GetAxis("Horizontal") * tiltAngle; var Tilt2 = Input.GetAxis("Vertical") * tiltAngle; var target : Quaternion = Quaternion.Euler(Tilt2, 0, Tilt); transform.localRotation = Quaternion.Slerp(transform.localRotation, target, Time.deltaTime * smooth); } This is added to the Gun to react with the mouse : var amount : float = 0.02; var maxAmount : float = 0.03; var Smooth : float = 3; var SmoothRotation = 2; var tiltAngle = 25; private var def : Vector3; function Start () { def = transform.localPosition; } function Update () { var factorX : float = -Input.GetAxis("Mouse X") * amount; var factorY : float = -Input.GetAxis("Mouse Y") * amount; if (factorX > maxAmount) factorX = maxAmount; if (factorX < -maxAmount) factorX = -maxAmount; if (factorY > maxAmount) factorY = maxAmount; if (factorY < -maxAmount) factorY = -maxAmount; var Final : Vector3 = new Vector3(def.x+factorX, def.y+factorY, def.z); transform.localPosition = Vector3.Lerp(transform.localPosition, Final, Time.deltaTime * Smooth); var tiltAroundZ = Input.GetAxis("Mouse X") * tiltAngle; var tiltAroundX = Input.GetAxis("Mouse Y") * tiltAngle; var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ); transform.localRotation = Quaternion.Slerp(transform.localRotation, target,Time.deltaTime * SmoothRotation); } If you want to see its effect in my game : http://www.youtube.com/watch?v=EDxwk5iBcUI All that's left for you to do is alter them as you see fit in the inspector! Hope this was help-full friend.
  3. You are right it does distort a bit , however I'm not familiar with methods to alter aspect ratio from code. Feel free to show an example , for now a good quality picture will do.
  4. This is great thanks alot
  5. The battery pickup is extremly easy , simply add it to the object that you want as your import ( the pickup ) and there should be no problem? When you " player " enters the trigger and presses e the pickup sends a broadcast to the flashlight script which calls the pickup function. If you want a working example of this check out the horror/thriller starter in the example projects section
  6. Will definitely update when I get home later , thanx!
  7. What do you do? : 3D Modelling, Level design , Scripting, Animation, Sound and Textures. Do you require pay? : Depends on the scale of the project. Can you show us your prior work? : http://www.youtube.com/channel/UC5J7sfYxIscFnJmMrZLlQDg (I usually post most of my work) Age(Optional) : 20 Name(Optional) : Johannes Nienaber Contact Details : Johannesnienaber@gmail.com Other Information : I have no formal development training but I'm self taught in Unity and JavaScript and I have a lot of passion for this. Available For Hire: Not at this time Preferred Genre: RPG , FPS ,RTS
  8. Pretty cool! Can be used in many scenarios , thnx
  9. Hi , my mistake I accidentally cut out some of the code when copying to the post. The script is now updated and complete. Just copy again and all should be fine. BTW the problem was that the variable LightOn was never declared as a boolean, acting as the toggle.
  10. Haha its a balcony , thanks man !
  11. I see Distopia has an obviously better script but id like to point out that your script is based on mouse movement and this one is based on weapon movement (therefore player movement or WADS) so id like to post this anyway. I took a few minutes to look at the script and just change it slightly. Now it also makes use of the X axis therefore the gun tilts forward on input(movement). var smooth : float = 2; var tiltAngle : float = 15; function Update () { var Tilt = Input.GetAxis("Horizontal") * tiltAngle; var Tilt2 = Input.GetAxis("Vertical") * tiltAngle; var target : Quaternion = Quaternion.Euler(Tilt2, 0, Tilt); transform.localRotation = Quaternion.Slerp(transform.localRotation, target, Time.deltaTime * smooth); } I don't know if someone will find it use-full. I found the original script quite handy being a novice scriptwriter. After some playing around I noticed that for an optimal thriller/Horror feeling both scripts apllied have a great effect! Give it a try. (Mouse Tilt script and Movement Tilt script)
  12. I think its quite perfect , reminds me of Dead Trigger. I'm using this in my current project.
  13. This script was made by me by extracting,implementing and altering features from various scripts, as well as some of my own code. I do not take credit for all of the code. Flashlight Script var Flashlight : Light; //Connect the light source in the Inspector var LightOn : boolean = true; var LightDrainSpeed : float = 0; var BatteryLife : float = 0.0; var MaxBatteryLife : float = 0; var BatteryTex : Texture2D; //Optional//var FlashlightTrigger : AudioClip; function Update () { if (LightOn && BatteryLife >= 0) { BatteryLife -= LightDrainSpeed * Time.deltaTime; } Flashlight.light.intensity = BatteryLife; if(BatteryLife <= 0) { Batterylife = 0; } if(Input.GetKeyUp(KeyCode.F)) { //Optional//audio.PlayOneShot(FlashlightTrigger); if(LightOn) { LightOn = false; } else if(!LightOn && BatteryLife >= 0) { LightOn = true; } Lighten(); } } function ChargeBattery() { // function called by battery pickup BatteryLife = MaxBatteryLife; // sets full charge } function Lighten() { if(LightOn) { Flashlight.light.active = true; } else { Flashlight.light.active = false; } } function OnGUI() { var charge = 100 * BatteryLife/MaxBatteryLife; GUI.DrawTexture(Rect(10,40,20,20), BatteryTex); // to have it in text:GUI.Label(Rect(80,20,50,20), charge.ToString("F0")+"%"); GUI.HorizontalScrollbar(Rect (40,40,500,20), 0, charge,0, 100); } If you want the charge to be shown in text rather than with a scrollbar remove the (// to have it in text:) line. Battery Pick-up Script var GUIToggle: boolean = false; function OnTriggerStay(other: Collider) { GUIToggle = true; if (other.tag == "Player" && Input.GetKeyDown("e")) { // call the function ChargeBattery in the player or its children: other.BroadcastMessage("ChargeBattery"); Destroy(gameObject); // destroy the pickup } } function OnGUI () { if (GUIToggle == true) { GUI.Label (Rect (10, 70, 300, 40), "Press E to pick up Battery Pack"); } } function OnTriggerExit (Player : Collider) { GUIToggle = false; } I hope someone finds this usefull.
×
×
  • Create New...