#How to build a basic character controller?
1 messages · Page 1 of 1 (latest)
You could do the following:
- Have a managed system (
SystemBase) getting the input actions - Make that system query individual inputs on Update, and store them to an unmanaged ECS component (
IComponentData) - From that point on, you can access the input values from that component with ECS queries
Here's an example of using the new input system in DOTS (from Rival samples): https://github.com/Unity-Technologies/rival-samples/blob/master/Basic/Assets/Scripts/Player/BasicPlayerSystems.cs
Using the new input system's event-based approach will usually not be a great fit for ECS, because you'd need each and every input event "callback" to write to components via component lookups. So this is why we're going with a polling approach instead (which is also supported by the New Input System)
On the physics side of things, if you pick regular monobehaviour PhysX instead of either Unity.Physics or Havok, you won't be able to control the physics from bursted jobs, and all your physics objects will have to be GameObjects instead of entities.
So your character controller itself wouldn't really get most of the benefits of DOTS in that case, but it could still exist within a game where other things are implemented in ECS