Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Instantiating rigidbody error

$
0
0
Hi there,

I have what I feel should be a very simple question. I'm trying to instantiate a rigidbody by calling PhotonNetwork.Instantiate, but when I try to add it to this script it comes up with the error: No overload method for PhotonNetwork.Instantiate takes ‘3’ arguments. How can I edit this script so that it will still work in the same way and instantiate the object across the network?




using UnityEngine;
using System.Collections;

public class Shoot : MonoBehaviour {

public Rigidbody projectile;

public float speed = 20;



// Use this for initialization
void Start () {

}

// Update is called once per frame
void OnMouseDown() {

audio.Play();

{
Rigidbody instantiatedProjectile = PhotonNetwork.Instantiate(projectile,
transform.position,
transform.rotation)
as Rigidbody;

instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));

}
}
}

Viewing all articles
Browse latest Browse all 15755

Trending Articles