UnityTechnologies / GalacticKittens

Get started making multiplayer games with Netcode for GameObjects
https://unity.com/products/netcode
Other
196 stars 56 forks source link

Question: Where is the player bullet movement implemented? #12

Open lioilsources opened 12 months ago

lioilsources commented 12 months ago

Hi folks, great job, thanks for this useful sample.

I'm not able to find where is the kitten bullet movement implemented.

My bullet is spawned correctly but it is not moving. On "no network" version I was using something like this

rb.AddForce(firePoint.right * bulletForce, ForceMode2D.Impulse);

Can you point me out to the right file? Many thanks

emgamedev-unity3d commented 11 months ago

Hello!

Thank you for the feedback!

The bullets and the meteors use the MoveNetworkObjectLinearlyInOneDirection component for their movement.

On the bullet prefab (moving to the right in the +X axis): image

And here's the meteor prefab using it (moving to the left in the -X axis): image

Also, the RBs on these objects is set to kinematic, and colliders are set to be triggers.

Hope this helps!