[Character Controller Revamp] Initial Push#713
[Character Controller Revamp] Initial Push#713SketchFoxsky wants to merge 7 commits intoBasisVR:developerfrom
Conversation
Replaced Unity Character Controller with a Kinematic Rigidbody Character Controller
|
My IK updates have been merged! I will update this PR with some stuff later this weekend! |
dooly123
left a comment
There was a problem hiding this comment.
needs a bit of cleanup
| } | ||
|
|
||
| Vector3 up = UpDirection; | ||
| Vector3 pos = transform.position; |
There was a problem hiding this comment.
we can merge this with the below to getpositionandrotation
| public class BasisKinematicCharacterController : MonoBehaviour | ||
| { | ||
| // Capsule Collider | ||
| [SerializeField] private float _height = 2f; |
There was a problem hiding this comment.
lets make all of this stuff public or => single source of truth is better then bits and bobs
| /// MAYBE add native swimming! | ||
| /// | ||
| /// </summary> | ||
| [RequireComponent(typeof(Rigidbody))] |
There was a problem hiding this comment.
I hate the required component system, ok to keep just hate it
| } | ||
| } | ||
|
|
||
| public bool isGrounded => _isGrounded; |
There was a problem hiding this comment.
yer like at this point just expose the bool
There was a problem hiding this comment.
I didnt initially expose it cause I didnt want to touch LocalPlayerDriver too much, since some of my other changes got merged im going through and properly integrating it with it!
|
|
||
| #region UNITY LIFECYCLE | ||
|
|
||
| private void Awake() |
There was a problem hiding this comment.
dont do this initalize it from the local players bootup else you will create all kinds of race conditions
|
|
||
| private void SyncCapsule() | ||
| { | ||
| if (_capsule == null) return; |
There was a problem hiding this comment.
i love assumption code if the capsule is going to be there 99% of the time just remove the null
| } | ||
| } | ||
|
|
||
| Vector3 pos = transform.position; |
There was a problem hiding this comment.
we should really check if we can grab the position from a per frame control or by just doing it once
| // Phase 1: Cast UP to find ceiling clearance | ||
| float maxUpDist = _stepOffset; | ||
| GetCapsuleEnds(pos, out Vector3 up1, out Vector3 up2); | ||
| int hitCount = Physics.CapsuleCastNonAlloc( |
There was a problem hiding this comment.
works great double check we have enough hit buffers
| if (other == _capsule) continue; | ||
|
|
||
| if (Physics.ComputePenetration( | ||
| _capsule, position, transform.rotation, |
There was a problem hiding this comment.
we are costing so much performance from having to transform.position and transform.rotation all the time
| point2 = worldCenter - capsuleUp * halfHeight; | ||
| } | ||
|
|
||
| private int GetCollisionMask() |
There was a problem hiding this comment.
why are we not just caching this once?
Removed Legacy Character Controller check as it is not needed.
Changes made previously were not pushed or git stroked out IK changes from Developer branch broke need to rewire it! - Exposed more fields - Properly Cache Collision Masks - Cache transform data so its not being called a shit ton
IK changes were regressed during a previous merge, These will also be cherry picked later for an update upstream.
Replaced Unity Character Controller with a Kinematic Rigidbody Character Controller.
It's at a good point for others to start poking around it! I wanna add a few more things to it but it will require me to touch IK stuff and dooly is currently doing that so i'm gonna hold off on it till they're done!