x


Syncing particles

Hello, How would I go about syncing particles in a ray-casting script? The ray-casting script detects where the it was hit and then creates a particle there. How would I sync the particles with multiplayer? Thanks for the help!

more ▼

asked Jan 16 '12 at 05:43 AM

twoface262 gravatar image

twoface262
129 41 53 56

Particles and particle emitters are a purely graphical element to the system. I rather suspect you will find there is no way to synchronise their behaviour over multiple machines, as the varying graphics and CPU capability of each machine will cause variance in their display anyway.

Jan 16 '12 at 05:48 AM MarkFinn

Well, is there a way that I can create an emitter on at the same point on the other persons client. I don't care if the particles themselves sync perfectly I just want them to be on the other persons screen.

Jan 16 '12 at 05:50 AM twoface262

Well, that's easy. Do you know how to send RPC calls?

Jan 16 '12 at 06:27 AM syclamoth
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you want to synchronise bullet hits on walls, all you have to do is manage the raycasting on one machine, and then upon hits send a message with the position and normal of the hit to all the other clients!

[RPC]
void SpawnParticleEffect(Vector3 position, Vector3 normal)
{
    Instantiate(particlePrefab, position, Quaternion.LookRotation(normal));
}

If there's other behaviour you want to synchronise (like damage, knockback etc) you can use the same technique for that as well.

more ▼

answered Jan 16 '12 at 06:31 AM

syclamoth gravatar image

syclamoth
15k 7 15 80

Thank you so much! You guys are great!

Jan 16 '12 at 06:39 AM twoface262
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3885
x713
x659
x58

asked: Jan 16 '12 at 05:43 AM

Seen: 675 times

Last Updated: Jan 16 '12 at 06:39 AM