#Rival Character Controller.

1 messages · Page 1 of 1 (latest)

earnest swallow
#

I have been trying to move the fps example to be 3rd person. So to do that i removed the MainEntityCamera that was being set on the ClientGameSystem. I then added a ControlledCamera Entity to the FirstPersonPlayer, I then instantiate the OrbitCamera from the 3rd person setup and assign it to the FirstPersonPlayer in both the ClientGameSystem, and the ServerGameSystem.

i also copied the player movement from ThirdPersonPlayerSystem into FirstPersonPlayerSystem because that uses the rotation from the OrbitCamera.

This works until i rotate the camera and both the OrbitCamera in the client and the server are out of sync from its position and rotation as soon as i rotate the camera.

How should i go about making the OrbitCamera sync correctly?

Is this the right way to go about this or should i change this up some other way?

winter hare
#

It looks like you're on the right track, but you must now make sure camera rotation is part of prediction (because character rotation depends on it).

The way I'd recommend doing this is:

  • remove camera rotation code from OrbitCameraSystem
  • move that rotation code to the character aspect's variable update (store a cameraRotation GhostField in the character component, and do the rotation operations on this)
  • make OrbitCameraSystem use that rotation instead of calculating it

This way, the camera doesn't need to exist on the server too; we just manage its rotation in character prediction systems and our character relies on that rotation alone

earnest swallow
#

Awesome, thanks! I got that piece working. I tried making a build and i am not able to hit the join button, no errors or anything. nothing happens.

After checking out a bunch of stuff i read that you need to use unity platforms api. i cant even create a build with it. the documentation is basically non existent as well. https://docs.unity3d.com/Packages/com.unity.platforms@1.0/manual/index.html
which takes you to https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/ecs_building_projects.html

so i figured id try to make a new copy of rival and create a build from that, and i got the same issues.

using 2022.2.1f1. but it looks like 2022.2.5f1 is available, i can try that one out?