Character Controller Online FPS physics interactions

Hi,

I’m trying to use Character Controller Samples/Online FPS as a starting point for an fps online game.
I worked on adding pickup objects and interactions but I cannot get collision trigger on ghost objects I added in the world.

I also don’t see physicsMass, physicsShape component to be available when I try to add them on a ghost prefab.

Why is that and how is physics different on this example project? Thanks.

physicsMass, physicsShape component

These are part of the optional Custom Physics Authoring sample that can be downloaded from the package manager in the Unity.Physics package, but the built-in physics components do support baking to ECS physics component now. This project uses the latter

I worked on adding pickup objects and interactions but I cannot get collision trigger on ghost objects I added in the world.

The project is currently set up to have no physics (rigidbody) simulation, in order to save on performance. The first step would be to go to the ContentReferences scene, and then the GameResources subscene in it. In the GameResources subscene, select the PhysicsConfig GameObject, and in the PhysicsStep, set the Simulation Type to Unity.Physics.

This might fix it, but here’s a checklist to verify if not:

  • The pickups should have a Rigidbody, BoxCollider (or other collider shape), GhostAuthoringComponent, and GhostAuthoringInspectionComponent (optional but recommended just in case we notice something missing).
  • The pickups should either be instantiated by the server, or placed in the Map1’s subscene.
  • Try enabling Provides Contacts and IsKinematic on the pickup collider component in the inspector. I can’t remember if this is needed for trigger events to work in ECS physics, but it’s worth trying these just in case.

I should probably enable physics by default in this sample despite the overhead, because it’s definitely not something that’s obvious to figure out when users want to try adding features to the sample

1 Like