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. Yesterday
  3. Last week
  4. how the map will look in game when it's played. updating map and level.
  5. Earlier
  6. I'm thinking of updating this to a city. This is actually a large structure. The players would be way smaller in scale. Update on the game: I'm reworking a ton of stuff. I'm getting new music put into the game. I'm working hard sometimes. But I feel like I could work harder on this game. It seems it's getting some attention. it's picking up steam. I had to face a lot of obstacles and situations dealing with hard-drive failures and everything in between when I was developing. I even had to start over sometimes, many times actually. This is the type of work you have to put in, to make a possible legendary game. You have to promote the game, you have to work hard on modeling, and you have to put in some time, maybe to much time. Now, in some times, the legendary times, you do not have to work hard. Sometimes things happen the easy way. Hopefully, things will become easier and the ant army can attain epic glory.
  7. Hello everyone, I'm creating my first AR game, similar to Amazon AR, Which one should i use vuforia or ARCore && Arkit ? If ARCore && ARKit , should i download the sdks or get them from package manger ? or no differences between them ? Thanks alot!
  8. Johannes

    Grunt1914

    This is the third update for a new map, called Crater. Crater is a large, open ended sniping based map that can support a massive amount of players due to the surface area and many locations to explore. This map is largely suited to long range weapons such as rifles or longer range machine guns. The theme is a large desolated quarry that has tons of cover and vantage areas strewn about, providing plenty of cover for both long and short ranged combat battles. The map support all the weather conditions, being - clear, rainy and snowy. This map is quite experimental at this stage, and as of yet it is unclear how players will find the experience. As such the map is due to change in the coming weeks based on player feedback.
  9. Johannes

    Grunt1914

    This is the update for a new gun, the M1903 Springfield rifle. Over 84, 0000 of these rifles had been produced at Springfield Armory and Rock Island Arsenal for use in world war one, making it a very popular choice among US snipers and infantrymen. The model 1903, is an American five-round magazine fed, bolt-action service repeating rifle, which was also the official US rifle at a stage. At long range the weapon is very effective and deadly if used accurately. The rifle saw use long after world war one, making it as far as Vietnam. This shows the quality and overall effectiveness of the rifle even more.
  10. thanks mate you are a life saver... many thanks hope this could help someone else...thanks again..
  11. yeah its actually very simple to do but here you go: using UnityEngine; public class Peek : MonoBehaviour { public Transform cam; public Transform cam2; private float nextPos; private float nextPos2; private float dampVelocity; private float dampVelocity2; void Update() { float newPos = Mathf.SmoothDamp(cam.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos2 = Mathf.SmoothDamp(cam.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); float newPos3 = Mathf.SmoothDamp(cam2.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos4 = Mathf.SmoothDamp(cam2.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); cam.transform.localPosition = new Vector3(newPos, newPos2, cam.transform.localPosition.z); cam2.transform.localPosition = new Vector3(newPos3, newPos4, cam2.transform.localPosition.z); if (Input.GetKey("x")) { nextPos = 0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("z")) { nextPos = -0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("c")) { nextPos = 0.0f; nextPos2 = 0.0f; } else { nextPos = 0.0f; nextPos2 = 0.0f; } } /* [RPC] //Rpcs are not supported anymore since raknet got removed from unity use UNET or some other networking soulution (TNet is like raknet if you want a quick convert) void Test() {} */ } by the way i would not use the code the way it is it looks hacked together and will be pretty inperformant. Also there are no Remote procedure calls like that anymore, if you want to have networked methods you have to do it differently, wrote a quick comment on the side.
  12. Hi to all.. i used the great peek.jc script on my project an all worked fine until i upgraded to unity 2018.3 where js is deprecated so i would to aks if someone could try to convert it in c# herethe script..i tried but without good results. var cam : Transform; var cam2 : Transform; private var nextPos : float; private var nextPos2 : float; private var dampVelocity : float; private var dampVelocity2 : float; function Update () { var newPos = Mathf.SmoothDamp(cam.transform.localPosition.x, nextPos, dampVelocity, 0.2); var newPos2 = Mathf.SmoothDamp(cam.transform.localPosition.y, nextPos2, dampVelocity2, 0.2); cam.transform.localPosition.x = newPos; cam.transform.localPosition.y = newPos2; var newPos3 = Mathf.SmoothDamp(cam2.transform.localPosition.x, nextPos, dampVelocity, 0.2); var newPos4 = Mathf.SmoothDamp(cam2.transform.localPosition.y, nextPos2, dampVelocity2, 0.2); cam2.transform.localPosition.x = newPos; cam2.transform.localPosition.y = newPos2; if(Input.GetKey("x")){ nextPos = 0.7; nextPos2 = 0.0; }else if(Input.GetKey("z")){ nextPos = -0.7; nextPos2 = 0.0; }else if(Input.GetKey("c")){ nextPos = 0.0; nextPos2 = 0.0; // FIXED BUG ON "c" PRESS PREVOIUS VALUE "-1.0" JCLEON }else{ nextPos = 0.0; nextPos2 = 0.0; } } any help ti would be very appreciated ..thanks inadvance
  13. Hi i know this is a very old topic lol but i was using this script in my project and it worked great.. btw now i upgraded t ounty 2018.3 andmaybe since jc is deprecated script doesnt work anymore.. so please could someone try to coventer it to c# i tried but i'm not so able to make that...
  14. geckoo

    Time To Sprite

    The same, but allowing to create a background. Create an empty gameobject and put this script on it ++ using System.Collections; using UnityEngine; // convert time to sprite [RequireComponent(typeof(SpriteRenderer))] public class TimeToSprite : MonoBehaviour { Texture2D mTex; private Sprite mySprite; // sprite size which can be using like a fontSize [Range(1, 10)] public int fontSize = 5; // font and background color public Color _color = Color.red; public Color _background = Color.black; // each number use 5x3 pixels + 1 as space between them int marging = 4; // size int width; int height = 7; // five pixel + two for contour float time; // for deltaTime string str; // time as string string[] sChars = new string[] { "x", "x", "x", "x" }; // saved chars // each column will be displayed according a bit code int[] num0 = new int[] { 31, 17, 31 }; int[] num1 = new int[] { 17, 31, 16 }; int[] num2 = new int[] { 29, 21, 23 }; int[] num3 = new int[] { 21, 21, 31 }; int[] num4 = new int[] { 07, 04, 31 }; int[] num5 = new int[] { 23, 21, 29 }; int[] num6 = new int[] { 31, 21, 29 }; int[] num7 = new int[] { 01, 01, 31 }; int[] num8 = new int[] { 31, 21, 31 }; int[] num9 = new int[] { 23, 21, 31 }; int[] _dot = new int[] { 00, 10, 00 }; void Awake() { this.transform.localScale = new Vector3(fontSize, fontSize, 0); width = ((4 * marging) + 1); // because we use only 4 chars - 00.0 if (mTex == null) mTex = new Texture2D(width, height, TextureFormat.ARGB32, true); mTex.wrapMode = TextureWrapMode.Clamp; mTex.filterMode = FilterMode.Point; // pixel it mTex.Apply(); this.GetComponent<SpriteRenderer>().flipX = false; this.GetComponent<SpriteRenderer>().flipY = true; // fill sprite with background color for (int i = 0; i < height; i++) for (int j = 0; j < width; j++) mTex.SetPixel(j, i, _background); } // clear only concerned part of the sprite according a new pattern void refresh(int shift) { int x = 1; // a value to center process (one pixel inside sprite) for (int i = x; i < height - x; i++) for (int j = x; j < marging; j++) mTex.SetPixel(j + shift, i, _background); } void UpdateTexture() { mTex.Apply(); // apply new texture as sprite after modification var mySprite = Sprite.Create(mTex, new Rect(0.0f, 0.0f, mTex.width, mTex.height), new Vector2(0.5f, 0.5f), 100.0f, (uint)0); this.transform.GetComponent<SpriteRenderer>().sprite = mySprite; } void timer() { // we use only one digit str = time.ToString("00.0").Replace(",", "."); for (int i = 0; i < str.Length; i++) { // check if the new number is the same (or not) than the previous if (str.Substring(i, 1) != sChars[i]) { // erase the previous pixel zone for this index refresh(i * marging); if (str.Substring(i, 1) == "0") pencil(i * marging, num0, _color); else if (str.Substring(i, 1) == "1") pencil(i * marging, num1, _color); else if (str.Substring(i, 1) == "2") pencil(i * marging, num2, _color); else if (str.Substring(i, 1) == "3") pencil(i * marging, num3, _color); else if (str.Substring(i, 1) == "4") pencil(i * marging, num4, _color); else if (str.Substring(i, 1) == "5") pencil(i * marging, num5, _color); else if (str.Substring(i, 1) == "6") pencil(i * marging, num6, _color); else if (str.Substring(i, 1) == "7") pencil(i * marging, num7, _color); else if (str.Substring(i, 1) == "8") pencil(i * marging, num8, _color); else if (str.Substring(i, 1) == "9") pencil(i * marging, num9, _color); else if (str.Substring(i, 1) == ".") pencil(i * marging, _dot, _color); } // save the char at its index so as to compare it with the next sequence sChars[i] = str.Substring(i, 1); } // update our texture UpdateTexture(); } // convert a number as a bool array private bool[] ConvertByteToBoolArray(byte b) { bool[] r = null; r = new bool[height]; // don't read all bit for (int i = 0; i < r.Length; i++) r[i] = (b & (1 << i)) == 0 ? false : true; return r; } void pencil(int shift, int[] seq, Color color) { // read each integer as pixels column for (int i = 0; i < seq.Length; i++) { var lol = (byte)seq[i]; var ss = ConvertByteToBoolArray(lol); // read bool array to know where a black pixel must be displayed for (int j = 0; j < height; j++) if (ss[j] == true) mTex.SetPixel((shift + i) + 1, j + 1, color); } } ////////////////////////////////////////////////////////// // as an example, we show deltaTime IEnumerator Start() { timer(); while (true) { yield return new WaitForSeconds(0.09f); timer(); } } private void Update() { time += Time.deltaTime; // set max if (time >= 99.9f) time = 99.9f; } }
  15. geckoo

    Time To Sprite

    Since Unity 2019.1 use a comma instead a dot displaying float number as string, we have to replace it : str = time.ToString("00.0").Replace(",", ".");
  16. hey there i made a small script and it should only transition between cameras when the room was entered. The first 2-3 times it always works but then it wouldnt work and work sometimes again. here is a video of the problem: and here is the script just without the debug output (debug log in video gets called on trigger enter) using UnityEngine; public class CameraMove : MonoBehaviour { private Transform mainCamera; [Header("Where should the Camera be placed in the Room:")] public Transform cameraPosition; private Vector3 startPos; private Quaternion startRot; private float completion; private bool lerp = false; void Start() { mainCamera = GameObject.FindWithTag("MainCamera").transform; } void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { startPos = mainCamera.position; startRot = mainCamera.rotation; completion = 0; lerp = true; } } private void Update() { if (lerp) { if (Vector3.Distance(cameraPosition.position, startPos) > 0.1f) { completion += Time.deltaTime; mainCamera.position = Vector3.Lerp(startPos, cameraPosition.position, completion); mainCamera.rotation = Quaternion.Lerp(startRot, cameraPosition.rotation, completion); } else { lerp = false; } } } } i feel stupid ^^ should be something simple im missing. The script gets assigned to each room, both of them have a box collider which is marked as trigger. Thanks for the help Edit: I have fixed it! If you want you can use the code. Here is the fixed Version: using UnityEngine; public class CameraMove : MonoBehaviour { public static Transform mainCamera; [Header("Where should the Camera be placed in the Room:")] public Transform cameraPosition; private Vector3 startPos; private Quaternion startRot; private float completion; private bool lerp = false; void Start() { mainCamera = GameObject.FindWithTag("MainCamera").transform; } void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { startPos = mainCamera.position; startRot = mainCamera.rotation; completion = 0; lerp = true; } } private void Update() { if (lerp) { if (Vector3.Distance(cameraPosition.position, mainCamera.position) > 0.1f) { completion += Time.deltaTime; mainCamera.position = Vector3.Lerp(startPos, cameraPosition.position, completion); mainCamera.rotation = Quaternion.Lerp(startRot, cameraPosition.rotation, completion); } else { lerp = false; } } } } }
  17. Johannes

    Grunt1914

    This is the update for a new weapon, the US Bolo Machete M1909. The M1909 Bolo Machete was designed to aid US soldiers with jungle foliage and heavy bushes that they often struggled to traverse. The machete turned out to become a great fighting weapon too, and was used for both a travel tool and a combat weapon. It was designed to be carried as an additional melee weapon from its first production in 1909 to its final production in 1915. Only around 17000 were produced making them pretty rare. This weapon has massive stab damage, with medium charge and swing damage, making it useful as an all round melee option, especially because of its high speed.
  18. Johannes

    Grunt1914

    This is the update for a new weapon, the Trench Raiding Club. The Trench Raiding Club is a widely used weapon in world war history, especially in battles where trenches were prominent. This makes it a very interesting addition for Grunt1914. This melee oriented club is a handmade version of a more structured and mechanically formed club, with spikes or nails hammered through, to deliver piercing damage as an extra feature. These were often made from existing clubs or even sturdy branches or logs, with relative ease. Because of its availability weapons like these were often made in bulk from small groves or logging encampments near battle sites. They would be given to soldiers as an extra means of protection or in some cases assault. This weapon has little stab damage, but excellent charge and swing damage, making it useful as an all round melee option, regardless of its slower speed. One hits kills are often possible with this weapon, if aimed at the upper body or head region of a soldier.
  19. nevermind ..solved by myself i simply changed this line if(Physics.Raycast(transform.position, transform.forward, out hits, 1.5f, layerMask.value)) into this if(Physics.Raycast(transform.position, transform.forward, out hits, 0f, layerMask.value)) this solved some really annoying bugs on items distance pickups since beforewhen player tried to pickup really near objets since the "hlding distance " was too big several times picked objects fall under floor when player tried to pickup them.. now this bug is gone.. ..I'm really happy... thanks to all
  20. hi mate and thanks for your reply too but i cannot undrestood whha you mean.. can you elaborate please?? thanks in advance
  21. hi and thanks i tried with: Physics.IgnoreLayerCollision(9, 15); // there are the affectd layers "Player" and "Pickup" and with Physics.IgnoreCollision(obj.GetComponent<Collider>(), GetComponent<Collider>()); where "obj" is the generic carried Gameobject but i dont know if i done correcly btw thisis my complete GrabObjects scritp if could help 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 public GameObject InteractUIPickupThrowRotate;//ADDON JC LEON public GameObject InteractUIPickup;//ADDON JC LEON ONLU PICKUP public GameObject StaticCross;//ADDON JC LEON ONLU PICKUP // UI Integration End //ADDon JC LEON [Header("JC LEON Weight Integration")] [Tooltip("Set the max mass for rigidbodies to be picked up")] public float maxMass = 10; private float mass, curthrowPower; [Header("JC LEON Object Rotation Integration")] public float rotateSpeed; public KeyCode rotateL; public KeyCode rotateR; // public bool setObjectRotation; public bool isGrabbing; //public float followSpeed; //public float forceToDrop; public float distanceToDrop; [Header("JC LEON other scripts References Integration")] public WeaponManager weaponManager; public ObjectExamineManager objectExamineManager; public float GrabTime; public bool _canPickup;//ADDON JC LEON ONLY PICKUP OBJECt //Addon JC LEON void Update () { CheckObjectForPickupOnly();//ADDON JC LEON ONLY PICKUP 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) if (/*pickable &&*/ hit.rigidbody && !hit.rigidbody.isKinematic && hit.rigidbody.mass <= maxMass && WeaponManager.instance.WeaponCurrentlySelected() == false) { if (Inventory.instance.currentlyHeldItem != null){ Inventory.instance.UnHoldItem(); Inventory.instance.UnHighlightSelectedSlot(Inventory.instance.SelectedSlot); Inventory.instance.UnSelectSlot(); Inventory.instance.HideActionButtons(); } //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; } else { if (/*pickable*/ hit.rigidbody && !hit.rigidbody.isKinematic && hit.rigidbody.mass > maxMass) // Addon JCLEON { Debug.Log("Hey"); pickable.ShowMessage(); } } } } //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 (isGrabbing) { GrabTime = Time.time; Debug.Log("time"); } if (!isGrabbing) { GrabTime = 0.0f; } if (Input.GetKeyUp(KeyCode.Mouse1)) { if(grab) { StartCoroutine(PrepareToDrop(0f)); } } if (Input.GetKeyDown(KeyCode.Mouse0)) { if(grab) { StartCoroutine(PrepareToDrop(curthrowPower));//ADDON JCLEON } } if(grab) { obj.transform.position =Vector3.Lerp(obj.transform.position, pos.position + (pos.transform.forward * adjust) /*- (pos.transform.up * 0.4f)*/, Time.deltaTime * 3f /*grabPower*/); //obj.transform.rotation = Quaternion.Lerp(obj.transform.rotation, pos.rotation, Time.deltaTime * 5f); 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 InteractUIPickupThrowRotate.SetActive(true);//ADDON JC LEON UI isGrabbing = true;//ADDON JCLEON weaponManager.enabled = false;//ADDON JCLEON objectExamineManager.enabled = false;//ADDON JCLEON obj.isKinematic = false;//ADDON JCLEON obj.GetComponent<Rigidbody>().useGravity = false;//ADDON JCLEON obj.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;//ADDON JCLEON obj.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;//ADDON JCLEON InteractUIPickup.SetActive(false);//ADDON JC LEON ONLU PICKUP //Physics.IgnoreLayerCollision(9, 15); //Physics.IgnoreCollision(obj.GetComponent<Collider>(), GetComponent<Collider>()); } } 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; InteractUIPickupThrowRotate.SetActive(false);//ADDON JC LEON UI isGrabbing = false;//ADDON JCLEON weaponManager.enabled = true;//ADDON JCLEON objectExamineManager.enabled = true;//ADDON JCLEON obj.GetComponent<Rigidbody>().useGravity = true;//ADDON JCLEON obj.constraints = RigidbodyConstraints.None;//ADDON JCLEON } //ADDON JC LEON START public void Drop() { StartCoroutine(PrepareToDrop(0f)); } //ADDON JC LEON END // ADDON JC LEON ONLY PICKUP START public void CheckObjectForPickupOnly() { if (!weaponManager.disarmed) { _canPickup = false; InteractUIPickup.SetActive(false); StaticCross.SetActive(false); return; } RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit, RayDistance, layerMask.value)) { Pickable pickable = hit.collider.GetComponent<Pickable>(); if (hit.rigidbody && !hit.rigidbody.isKinematic /*&& hit.rigidbody.mass <= maxMass*/ && pickable.isPickableOnly) { InteractUIPickup.SetActive(true); _canPickup = true; StaticCross.SetActive(true); } else { _canPickup = false; InteractUIPickup.SetActive(false); StaticCross.SetActive(false); } } else if (_canPickup == true) { _canPickup = false; InteractUIPickup.SetActive(false); StaticCross.SetActive(false); } } // ADDON JCLEON OLY PIVKUP END } with no results
  22. What’s with the yield return null? Shouldnt you yield to end of frame? don’t think your code is being reached after the while statement if your returning unless I’m reading that wrong. Throw a debug after the while loop to make sure that part of the code is being reached
  23. another idea would be to disable the collider and enabling a trigegr object infront of the player that takes case of collisions or a boxcast
  24. Disable the collision between the player and the carried object manually. https://docs.unity3d.com/ScriptReference/Physics.IgnoreCollision.html
  25. I think this should have been one of the first things to create, all of the systems use player input in some way, so it is going to get more and more complicated to implement as time goes on. Also, you should tone down the bloom, it makes the screen very hectic.
  26. Hi ,yes i know i made a similar threah some time ago and I have my pickup and grab script fully functional an working but sincerly i'm not completely satisfied with it...since i have a little issue.. my grab script is based on standard fpskit 1.6 GrabObjects script but heavily modified.. the issue is related to the fact i need to left the box collider active even when object is picked up to prefent it clipping with other object but when i left that active and try to set the adjust position to a value lower than 2.5 the grabbed obejct reamins stucked on player after picked up and player cannot leave it.. i was thinking this could be related to the physics interaction layer but tired to disable the interaction between the two interested layer ( pickup and playr) but issues remains.. i was thinking this could be caused from my modified scirpt so i tried with original GrabObjects script but when i left atvie the collider on obejct picjed up and lower the adjust position issue is there.. here the original fpskit 1.5 Grabobjects script using System.Collections; using System.Collections.Generic; using UnityEngine; 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; 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) { grab = true; obj = hit.rigidbody; obj.isKinematic = true; obj.GetComponent<Collider>().enabled = false; obj.transform.parent = pos; } } } if (Input.GetKeyUp(KeyCode.Mouse1)) { if(grab) { StartCoroutine(PrepareToDrop(3f)); } } if (Input.GetKeyDown(KeyCode.Mouse0)) { if(grab) { StartCoroutine(PrepareToDrop(throwPower)); } } if(grab) { 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); } } 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; } } and here a video of the issue ehere a little video with the default fpskit grabobjects script and the modified obj.GetComponent<Collider>().enabled = true;
  1. Load more activity
×
×
  • Create New...