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.


Premium Member
  • Content Count

  • Joined

  • Last visited

  • Days Won


fpsarmedunity last won the day on October 25 2016

fpsarmedunity had the most liked content!

Community Reputation

17 Good

About fpsarmedunity

Profile Information

  • Gender
  • Location:

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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;
  2. YES you are right but sincerly i cannot figured what is the problem.. so i put it in hold for now.. btw really many many thaks for your help-- thanks bro..
  3. nope...all messed up ..i think there is something strange here... bout yur suggestion to remove radar . simply disabled radar gameobject to test.. right?
  4. thanks mate but it's all messed the same i test even with you gently provided scrpt and create cube and assigne the player as script and target and this is the result
  5. yes its not this the case.. i' going to find a good asset on the store LOlL
  6. hi and thanks for your effprt and for your new code.. it's seems to work a little better than mine but not good at all.. btw you gave me an hint.. main camera is not the only on the scen of player since it has a weapon camera too.. could this will be a problem'
  7. i tired everything but sincerly cannot figure how t omake indicator to show correct damage position...i think i'm goging to purchase a premade asset from the store
  8. hi and thanks to both but i solved by myslf with this foreach (SkinnedMeshRenderer renderer in _currentObject.GetComponentsInChildren<SkinnedMeshRenderer>()) { renderer.enabled = false; } where "_currentObject" is the Gameobject that contains the skinned meshes
  9. i tested increasig the alpha value tto show the indicator from the start and with values you can sse in the video i got that
  10. ys damage indicator texture point upwards i really cannot figure how t ocall it for a debug script to test position...
  11. Hi I'm working on my ecamine system for my project an all works fine but i have a little issue when examininig object i want examned object renderer to be disabled and i figured this with this line of code _currentObject.GetComponentInChildren<Renderer>().enabled = false;// ADDon render object on examine enabled after examination: and renenable it after examination with _currentObject.GetComponentInChildren<Renderer>().enabled = true;// ADDon render object on examine enabled after examination: and all works as ecpected but my probme is that my weapons object have many meshes and not a single mesh renderer it tried with GetComponentsInChildren but only the first skinned mesh is disabled for thie gameobject ...how can i solve this?
  12. which is wrong with mine using UnityEngine; using System.Collections; public class DamageIndicator : MonoBehaviour { /// <summary> /// Attack from direction /// </summary> [HideInInspector] public Vector3 attackDirection; /// <summary> /// time reach for fade arrow /// </summary> public float FadeTime = 3; public Texture damageIndicatorTexture; public Color ArrowColor = new Color(0.85f, 0, 0); /// <summary> /// the transform root of player /// </summary> public GameObject target; //Private public Vector2 pivotPoint; public float alpha = 0.0f; public float offset = 350f; public float rotationOffset; /// <summary> /// /// </summary> void OnGUI() { if (this.alpha > 0) { this.offset = Screen.height / 4; GUI.color = new Color(ArrowColor.r, ArrowColor.g, ArrowColor.b, this.alpha); Vector2 vector = new Vector2(((Screen.width / 2) - (this.damageIndicatorTexture.width / 2)), (Screen.height / 2) - this.offset); this.pivotPoint = new Vector2((Screen.width / 2), (Screen.height / 2)); GUIUtility.RotateAroundPivot(this.rotationOffset, this.pivotPoint); GUI.DrawTexture(new Rect(vector.x, vector.y, this.damageIndicatorTexture.width, this.damageIndicatorTexture.height), this.damageIndicatorTexture); } } /// <summary> /// Use this to send a new direction of attack /// </summary> /// <param name="dir">postion of attacker</param> public void AttackFrom(Vector3 dir) { //target = this.transform ; this.attackDirection = dir; this.alpha = 3f; } /// <summary> /// if this is visible Update position /// </summary> void Update() { // Player Clone integration Start if (target == null) if (GameObject.Find("Player")) target = GameObject.Find("Player"); // player clone integration end if (this.alpha > 0) { this.alpha -= Time.deltaTime; this.UpdateDirection(); } } /// <summary> /// update direction as the arrow shows /// </summary> void UpdateDirection() { Vector3 rhs = this.attackDirection - this.target.transform.position; rhs.y = 0; rhs.Normalize(); Vector3 forward; if (Camera.main != null) { forward = Camera.main.transform.forward; } else { if (Camera.current != null) { forward = Camera.current.transform.forward; } else { forward = this.transform.forward; } } float GetPos = Vector3.Dot(forward, rhs); if (Vector3.Cross(forward, rhs).y > 0) { this.rotationOffset = (1f - GetPos) * 90; } else { this.rotationOffset = (1f - GetPos) * -90; } } }
  • Create New...