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.

All Activity

This stream auto-updates     

  1. Today
  2. solved by myslef (using the second scirpt posted by me) setting kinematic to true on grab object, and use gravity to false and blocking object constraints by script when object held by player. and unfreezeing contraints and turn gravity in again when object is dropped by the player... now my grab script works fine as i want and as expected andi can integrate it in my main project template.. and have pickup, throw object rotation by button when held by the player and collision detection so when player held object and object collide with another static gameobject or with another ridigdbody gameobejct it falls.. this is to simulate contact between obejct and to prevent object flipping ,,, btw thanks again. ..for all help....
  3. Hello,i'm kind a new in programing and i hope can someone help me to make a damage script on my game,cause i can t figure out how. Here is my health script,and hope someone can help. using UnityEngine; using UnityEngine.Networking; namespace S3 { public class PlayerHealth : NetworkBehaviour { public const int maxHealth = 100; [SyncVar(hook = "OnChangeHealth")] public int currentHealth = maxHealth; public RectTransform healthbar; public void TakeDamage(int ammount) { if(!isServer) { return; } currentHealth -= ammount; if(currentHealth <=0) { currentHealth = maxHealth; RpcRespawn(); } } void OnChangeHealth(int health) { healthbar.sizeDelta = new Vector2(health * 2, healthbar.sizeDelta.y); } [ClientRpc] void RpcRespawn() { if(isLocalPlayer) { transform.position = Vector3.zero; } } } }
    My God, what a perfect kit, thank you!
  4. The FPSController dont work without the InGameMenu script,it cant move without it,how do i fix this?
  5. Yesterday
  6. Hi and thanks for your help and script.. bte my script problem is that held obcjet seems to flip ahead and and back in really strange and rapid mode when player move and held.. you can see the issue after 20" on video i linked to first post.. btw i modidied even the standard GraObjects scirpt that comes with fpskit 1.6 to suit my needs adding rotation on held and max mass for objects to be held by the player butthis script has an issue related t othe kinematic state of the object when held so that obejct could penetrate static objects and meshes.. eventually even if you or someone else could tell me how make object to kinematic to collide wtih static object i can use this one eventually here the script using System.Collections; using System.Collections.Generic; using UnityEngine; using EasySurvivalScripts; public class GrabObjects : MonoBehaviour { //FPS KIT [www.armedunity.com] public float grabPower = 10.0f; public float throwPower = 25.0f; public float RayDistance = 3.0f; public LayerMask layerMask; private bool grab, drop = false; public Transform pos; public float adjust; Rigidbody obj; // UI Integration Start public GameObject InteractUIPickupExamine;//ADDON JC LEON public GameObject InteractUIExamine;//ADDON JC LEON public GameObject InteractUIPickupExamineCollectable;//ADDON JC LEON public GameObject InteractUIExamineCollectable;//ADDON JC LEON // UI Integration End //ADDon JC LEON public float maxMass = 10; private float mass, curthrowPower; public float rotateSpeed; public KeyCode rotateL; public KeyCode rotateR; // public bool setObjectRotation; public bool isGrabbing; //public float followSpeed; //Addon JC LEON public WeaponManager weaponManager; public ObjectExamineManager objectExamineManager; void Update () { if (Input.GetKeyDown(KeyCode.Mouse1)) { RaycastHit hit; if(Physics.Raycast(transform.position, transform.forward, out hit, RayDistance, layerMask.value)) { Pickable pickable = hit.collider.GetComponent<Pickable>(); if (/*pickable*/ hit.rigidbody && !hit.rigidbody.isKinematic && hit.rigidbody.mass <= maxMass) // Addon JCLEON { //ADDON JCLEON mass = hit.rigidbody.mass; if (mass < 2) mass = 2; curthrowPower = throwPower / mass; //ADDON JCLEON grab = true; obj = hit.rigidbody; obj.isKinematic = true; obj.GetComponent<Collider>().enabled = false; obj.transform.parent = pos; } } } //ADDON JCLEON START if (isGrabbing) { if (Input.GetKey(rotateL)) { obj.transform.Rotate(new Vector3(0, rotateSpeed * Time.deltaTime, 0)); } if (Input.GetKey(rotateR)) { /* obj.transform.Rotate(new Vector3(0, -(rotateSpeed * Time.deltaTime), 0));*/ obj.transform.Rotate(new Vector3(rotateSpeed * Time.deltaTime, 0, 0)); } } //ADDON JCLEON END if (Input.GetKeyUp(KeyCode.Mouse1)) { if(grab) { StartCoroutine(PrepareToDrop(0f)); } } if (Input.GetKeyDown(KeyCode.Mouse0)) { if(grab) { StartCoroutine(PrepareToDrop(curthrowPower));//ADDON JCLEON } } if (grab) { if (obj.GetComponent<Rigidbody>() == null) { return; } obj.transform.position = Vector3.Lerp(obj.transform.position, pos.position + (pos.transform.forward * adjust) - (pos.transform.up * 0.4f), Time.deltaTime * grabPower); //obj.transform.rotation = Quaternion.Lerp(obj.transform.rotation, pos.rotation, Time.deltaTime * 5f);//ADDON JCLEON obj.GetComponent<Collider>().enabled = true; // ADDON JCLEON ENABLE OBJECT COLLISION WHEN OBJECT IS GRABBED BY THE PLAYER InteractUIPickupExamine.SetActive(false);//ADDON JC LEON UI InteractUIExamine.SetActive(false);//ADDON JC LEON UI InteractUIPickupExamineCollectable.SetActive(false);//ADDON JC LEON UI InteractUIExamineCollectable.SetActive(false);//ADDON JC LEON UI isGrabbing = true;//ADDON JCLEON weaponManager.enabled = false; objectExamineManager.enabled = false; } } IEnumerator PrepareToDrop(float power) { RaycastHit hits; while(!drop) { if(Physics.Raycast(transform.position, transform.forward, out hits, 1.5f, layerMask.value)) drop = false; else drop = true; yield return null; } obj.transform.parent = null; obj.isKinematic = false; obj.GetComponent<Collider>().enabled = true; obj.velocity = transform.forward * power; drop = grab = false; // yield return new WaitForSeconds(0.1f); //InteractUIPickupExamine.SetActive(true);//ADDON JC LEON UI //InteractUIExamine.SetActive(true);//ADDON JC LEON UI //InteractUIPickupExamineCollectable.SetActive(true);//ADDON JC LEON UI isGrabbing = false; weaponManager.enabled = true; objectExamineManager.enabled = true; } } thanks again in advance...
  7. I have no clue what goes wrong with your script, but take a look on mine which I share here - maybe it could work better ++ https://armedunity.com/topic/10181-gravitygun/?tab=comments#comment-90194
  8. Hi to all..I done some test with my drag rigidbody script that includes mass pickup and stop distance...all works fine but i have a weird issue on player movement with object picked ip.. as you cna see in the video attached.. https://streamable.com/han80 this is my script ..but i cannot figured to to solve this issue since i have this probem only on fpskit player( picked object seems to flip in front of the player camera when player move) and if i test it with standard unity fps controller all works as expecetd using UnityEngine; using System.Collections; public class DragRigidbody : MonoBehaviour { public float force = 50; public float sensitivity = 25; public float heightValue = 0.35f; public float heightValueMax = 2; public float heightValueMin = 1; public float distance = 10; public float maxMass = 10; public float stopDistance = 3; private Rigidbody body; private float mass, curHeight, curForce; private Transform clone, local; private static bool _get; public static bool isDrag { get{ return _get; } } void Update() { if(Input.GetMouseButtonDown(1)) { body = GetRigidbody(); } else if(Input.GetMouseButtonUp(1) && body) { Clear(); } else if(Input.GetMouseButtonDown(0) && body) { Rigidbody tmpBody = body; Clear(); tmpBody.velocity = Camera.main.transform.TransformDirection(Vector3.forward) * curForce; } if(Input.GetAxis("Mouse ScrollWheel") > 0 && body) { NewHeight(heightValue); } else if(Input.GetAxis("Mouse ScrollWheel") < 0 && body) { NewHeight(-heightValue); } } void NewHeight(float value) { curHeight += value; curHeight = Mathf.Clamp(curHeight, heightValueMin, heightValueMax); if(curHeight == heightValueMin || curHeight == heightValueMax) return; clone.position += new Vector3(0, value, 0); } Rigidbody GetRigidbody() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(new Vector2(Screen.width/2, Screen.height/2)); if(Physics.Raycast(ray, out hit, distance)) { if(hit.rigidbody && !hit.rigidbody.isKinematic && hit.rigidbody.mass <= maxMass) { mass = hit.rigidbody.mass; if(mass < 2) mass = 2; curForce = force / mass; hit.rigidbody.useGravity = false; hit.rigidbody.freezeRotation = true; clone.position = hit.point; return hit.rigidbody; } } return null; } void SetLocal() { if(_get) return; local.rotation = body.rotation; local.position = body.position; //local.transform.position = Vector3.Lerp(local.transform.position, local.position + (local.transform.forward * 2) - (local.transform.up * 0.4f), Time.deltaTime * force); _get = true; } float RoundTo(float f, int to) { return ((int)(f*to))/(float)to; } void FixedUpdate() { if(!body) return; Vector3 lookAt = Camera.main.transform.position; lookAt.y = clone.position.y; clone.LookAt(lookAt); //SetLocal(); body.velocity = (local.position - body.position) * sensitivity; body.rotation = local.rotation; float dist = Vector3.Distance(body.position, local.position); dist = RoundTo(dist, 100); if(dist > stopDistance) { body.velocity = Vector3.zero; Clear(); } } void CheckVelocity() { Vector3 velocity = body.velocity.normalized * curForce; if(body.velocity.sqrMagnitude > velocity.sqrMagnitude) { body.velocity = velocity; } } void Clear() { curHeight = 0; _get = false; clone.localPosition = Vector3.zero; local.localPosition = Vector3.zero; if(!body) return; CheckVelocity(); body.useGravity = true; body.freezeRotation = false; body = null; } void Start() { if(!clone) { local = new GameObject().transform; clone = new GameObject().transform; local.parent = clone; clone.parent = Camera.main.transform; } heightValueMin = -Mathf.Abs(heightValueMin); heightValueMax = Mathf.Abs(heightValueMax); Clear(); } }
  9. Last week
  10. I’m just generating the clouds using 2d simplex noise on a chunk by chunk basis. So when I chunk is generated, if that chunk is in a blob zone, build a cloud that covers the top of that chunk
  11. "Nothing here is working" = what exactly is not working? maybe contact author, or ask for help in forum. broken = only for noobs. If project was made in older version of unity engine - errors are expected.... outdated = we are not removing old files and there are many devs who are using old versions of unity engine. Also if you are not noob, you can update any project.
  12. So a little update. I just got back from vacation and dabbled in this again a little. I fixed some of the bugs including the tree leaf problem between chunks. Also added clouds and plants and a temp main menu to input seeds and swap texture packs and so on. Just wanted to show a bit bc yes, I'm not just stopping at a simple voxel terrain and calling it finished like what you normally see people doing, I will be doing the whole show just my own version of it the way I want it
  13. click email activation ? anyways Nothing here is working . everything outdated and broken
  14. Hello Armed Unity members! After we, Y8.com, were and still are actively working with Unity WebGL games for more than 4 years, I am glad to inform you about an upcoming feature from our end. For quite few months now we had a small and closed beta circle of game partnership of various technologies (unity webgl, html5, pluginfree engines etc..) and in the upcoming month or two, we will publicly introduce our plan and chance to additionally monetize your online games. In case this topic is in the wrong section, I apologize as I couldn't find a more appropriate one. Back on topic, what we offer is: - Adsense Ads - 50% of in-game video ads - 10-40% of content page ads - API tools for online features - QA testing What we need: - long-term relationship with quality individuals or teams - quality games - online versions, leaving the standalone or mobile for your own plans and releases What is worked on - a custom dashboard where any developer can see stats for his/her games, in bulk or individual - simplified API guide documentation - new features and better support for all current and upcoming partners The given example of ecmp $1-3 is mostly for all types of accepted games, although I can verify that the games which have highest ecpm are 3D based, from which the 3D First Person Shooters are always around the top performer. This doesn't mean that hits like 2D physics won't have good results as well. Feel free to use the contact form at Y8 website, or directly write in here or in PM and we'll move onto the next process. If you have any questions, do let me know! Looking forward playing your games! Zoki.
  15. What do a difference between a shoot and a melee attack? Maybe the distance. There is the same mechanic - excepted that your raycasthit go ahead, but not too far. However personally I prefer to use a OverlapSphere. Create a position a little bit beyond player and set a radius. If an enemy is inside the sphere, you hit it. This way you can simulate a swipe movement ++ https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html
  16. geckoo

    Thermals?

    You can change enemies material as a local feature : Take a look at isLocalPlayer ++ https://docs.unity3d.com/2017.4/Documentation/ScriptReference/Networking.NetworkBehaviour-isLocalPlayer.html
  17. Earlier
  18. I've been trying a lot and I was not that knowledgeable to create a script for the melee. What I made is a shotgun without any reloads but still shoot projectiles. Is there anyway to add real melee weapons in this kit? Thanks in advance!
  19. Version 1.0.0

    1 download

    Un sistema de cámaras en tiempo real
  20. Version 1.0.0

    1 download

    Un simple asset que con tiene un sprite que hace un reflejo de lo que esta al rededor
  21. TRCGamez

    Thermals?

    Yeah I mean cod style. I already tried that thermal asset but there's really no way to see your enemies. I would change enemies mat, but I'm making a multiplayer FPS.
  22. Last update : Multiple game modes(Easy, Hard, Extreme)! Random shapes change can now be removed! Smooth play Events Less ads
  23. Hi @KingdomStudios, I would like to work as freelancer if there is any c# job position!
  24. geckoo

    Prime Numbers

    My understanding of code doesn't mean that it's always for a game. But in the same time, I remember a game in which you have to escape using doors with numbers - only prime numbers guarantee safe rooms - others are traps This game is called Bryan Audley's Numbers - it's not a really good game, but its mechanics are interesting. Also the main gameplay of this game reminds a great movie - Cube which I highly recommend ++
  25. Erarnitox

    Prime Numbers

    yes but for what do you use this in a game?
  26. geckoo

    Prime Numbers

    Yesterday I saw a disturbing video about prime numbers and their paradoxes. Then just for fun I decided to code a script so as to generate an infinite list with prime numbers. This script below shows as debug messages some prime numbers, starting from 1 until ... how many time you can wait using System.Collections; using UnityEngine; public class PrimeNumbers : MonoBehaviour { int n = 2; bool IsPrime(int number) { // remainder operator if (number % 2 == 0) return false; for (int i = 3; i <= Mathf.Sqrt(number); i += 2) if (number % i == 0) return false; return true; } private void Start() { Debug.Log(2); // this is our first prime number StartCoroutine(checkInteger()); } IEnumerator checkInteger() { if (IsPrime(n) == true) Debug.Log(n); yield return null; n++; StartCoroutine(checkInteger()); } }
  1. Load more activity
×
×
  • Create New...