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.

Xendz

Member
  • Content Count

    30
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Xendz

  • Rank
    Member

Profile Information

  • Gender
    Not Telling
  • Location:
    sdasds
  1. when I press "," to deploy cargo, its spawning the object up to 4 times, anyone know how to fix this I have tried multiple times to fix it but can't see to get it. public class PickUp : MonoBehaviour { public AudioClip pickup; public AudioClip dropdown; public GameObject blueft; void Update () { } void OnTriggerEnter(Collider player) { } public void OnTriggerStay(Collider other){ bool canClone = true; if (Input.GetKeyDown ("z")) { //drop item code audio.PlayOneShot (dropdown, 1.0f); transform.renderer.enabled = true; transform.parent = null; } if(Input.GetKeyDown("q")){ if (other.tag == "Ship"){ // only be picked by the player! transform.parent = Camera.main.transform; transform.renderer.enabled = false;// pick this object... audio.PlayOneShot(pickup, 1.0f); } } if (Input.GetKeyDown (",")) { if (gameObject.tag == "FlakCargo") { Instantiate(blueft, new Vector3 (transform.position.x, transform.position.y, transform.position.z), Quaternion.identity); } GameObject.Destroy (gameObject); } } }
  2. Xendz

    Projectile Flying

    Well i got everything running smoothly, anyone can help me with bullet drop so that it archs via the y transform? Ive tried but it drops drastically i need a slow drop
  3. Xendz

    Projectile Flying

    Only a year with unity, and thanks.
  4. Xendz

    Projectile Flying

    [RPC] void Shoot() { Vector3 fwd = transform.TransformDirection(Vector3.forward * 10); if (Physics.Raycast(SpawnLocation.position, fwd, out hit, WeaponRange)) { audio.PlayOneShot (GunShotSound); PhotonNetwork.Instantiate("Pulse", hit.point, Quaternion.identity, 0); }; } } So I got my projectile to finally Instantiate across the network, the problem is where im looking at on the screen is where it ends up flying to and exploding, instead of shooting out slow like a slow moving cannon ball which is what I want.... any ideas? I really need this fixed asap
  5. appreciate you guys for the help, and being patient lol.
  6. I did, I did what it said and its still not working...
  7. UnassignedReferenceException: The variable SpawnLocation of 'shootdemo' has not been assigned. You probably need to assign the SpawnLocation variable of the shootdemo script in the inspector. I assigned a transform in the inspector. Any help with this guys everything looks correct.... using UnityEngine; using System.Collections; public class shootdemo : MonoBehaviour { public RaycastHit hit; public int WeaponRange; public GameObject GunParticle; public AudioClip GunShotSound; public Transform SpawnLocation; PhotonView pv; // Use this for initialization void Start () { pv = this.GetComponent<PhotonView>(); } // Update is called once per frame void Update () { if(Input.GetMouseButtonUp(0)&& pv.isMine) { pv.RPC("Shoot", PhotonTargets.All); } } [RPC] void Shoot() { Vector3 fwd = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(SpawnLocation.position, fwd, out hit, WeaponRange)) { audio.PlayOneShot (GunShotSound); PhotonNetwork.Instantiate("Pulse",hit.point, Quaternion.identity, 0); }; } }
  8. I don't mind putting in the work its just annoying cause ive already watched the videos and still can't get my scripts to do what I want.
  9. I suppose this will probably take me awhile to figure out.
  10. yeah I figured that out, guessing I will get the transform of the startpos, and throw it in the second param.
  11. using UnityEngine; using System.Collections; public class shootdemo : MonoBehaviour { public GameObject projectile; public float speed = 20; PhotonView pv; // Use this for initialization void Start () { pv = this.GetComponent<PhotonView>(); } // Update is called once per frame void Update () { if(Input.GetMouseButtonUp(0)&& pv.isMine) { pv.RPC("Shoot", PhotonTargets.All); } } [RPC] void Shoot(){ Debug.Log("shoot"); GameObject monster = PhotonNetwork.Instantiate("Pulse", transform.TransformDirection(new Vector3(0, 0,speed)), Quaternion.identity, 0); } } Okay im getting closer, I can see it on both screens but I cant seem to spawn it at the gameobject instead it spawns in middle of map.
  12. well, im really new to RPC's so no not really. I dont understand the remote Shoot function.
×
×
  • Create New...