#Server Control Over "Bullet" Object

11 messages · Page 1 of 1 (latest)

remote stirrup
#

Post your code?

#

Also what exactly do you mean by doesn't really work?

halcyon dawn
#

`
if (collision.transform.tag == "Dirt")
{
if (isServer)
{
rayfireGun.Shoot(transform.position, transform.forward);

                RpcCallEffects("dirt", transform.position, collision.contacts[0].normal);
            }
        }

`

#

Inside the bullet script. Calleffects is now RpcCallEffects (and I changed out the collision / position to be just vectors so that was solved)

#

However the clientrpc isn't being called

#

Basically I thought the bullet is server controlled, and should only trigger this portion.

#

And since it's server it should trigger clientrpc

remote stirrup
#

can't see anything wrong from here. can you post the entire code on pastie? Aslo did rayfireGun.Shoot get executed?

halcyon dawn
#

Yes rayfireGun.Shoot gets executed

#

Not at the computer this moment. The only other thing I've been messing with was the [Server] part before collisionEnter for this bullet prefab.

halcyon dawn
#

`[ClientRpc]
public void RpcCallEffects(string effect, Vector3 position, Vector3 contactPoint)
{
if (effect == "dirt")
{
Instantiate(dirtImpactPrefabs[Random.Range
(0, dirtImpactPrefabs.Length)], position,
Quaternion.LookRotation(contactPoint));

        }
        if(effect == "Untagged")
        {
            Instantiate(concreteImpactPrefabs[Random.Range
                    (0, concreteImpactPrefabs.Length)], position,
                Quaternion.LookRotation(contactPoint));
        }

        Debug.Log("The server is telling us to show marks on the ground: " + effect);
    }`