How to create support for something like CharacterController.OnControllerColliderHit

I see that you added support for things like onCollisionEnter and a few other callbacks recently. I’m exploring creating basic support for CharacterController on the .ts side and wondering where a good place to start thinking about how to implement this type of functionality as it’s not as simple as getting serialized data.

Original Post on Discord

by user 106501920008445952

Could you elaborate on what you mean by “its not as simple as getting serialized data” ?

by user 106501920008445952

OnControllerColliderHit is called when the controller hits a collider while performing a Move.
I read this as the .cs class for CharacterController has logic in it somewhere to handle this type of callback.

by user 106501920008445952

I’m wondering if the way to support something like CharacterController (CC) is that I’d need to create the logic myself.

by user 106501920008445952

I guess I’ll just try spinning it up myself :slightly_smiling_face:

by user 106501920008445952

Yeah you would need to create the logic yourself - I probably need to give you some more data tho since you dont have real good access to the velocity in the onCollisionEnter callbacks

I’ll see where I get. I’m going to go through a great Unity book I have Unity in Action, Third Edition, but my plan is to do this using needle

by user 106501920008445952

I’ll create separate threads in the forum if I’m running into any walls

by user 106501920008445952

I’ll just expose the internal collision data I get from cannon for you - midterm we might to want to try other physics libraries tho but that will probably not happen too soon

cool interesting!

Perfect, that’ll be a great starting point

by user 106501920008445952

Change: Collision now exposes internal cannon data via __internalCollision property Nice!

by user 106501920008445952