VDP-noclip / noclip

NOCLIP is an experimental game in which you “noclip” the environment to solve puzzles.
3 stars 1 forks source link

Fix and clean the RealityMovement #45

Closed stefanofossati closed 1 year ago

stefanofossati commented 1 year ago

The script that manage the movement of the real player and its rigidbody presents some bugs:

The problem with too angled slopes comes from the fact that in AllPlayer there are two sources of drag instead of just one: RealityPlayer's Rigidbody (Drag set by GroundDrag) and RealityBody's CapsuleCollider (drag coming from Material that is actually a PhysicsMaterial). A fix I tried was to use the OnCollisionStay function, and I noticed that it triggers from very very slightly further than the function that tells the Grounded parameter, this solves the problem with slopes at the cost of fucking up the jump.

I think that calling slope checks and deciding whether the player is grounded only inside the OnCollisionStay function will fix the problem. This has to be done inside RealityMovement.cs, only after fixing the colliders.

---UPDATE--- Another problem that will be solved is that if you are on a slope that is less than max angle, but enough not to set you grounded (>45°) you will not be able to jump, and this will most likely look like a bug to the player because it is not motivated in any intuitive way (different it would be if you could at least do a mini jump)

stefanofossati commented 1 year ago

@TizioMaurizio I was obliged to add again Reality orientation object on the RealityPlayer. I know that is empty end it can be avoided, but with this object we have a more fluid movement of the player and of the view. Now the hyerarchy is: AllPlayer     ├RealityPlayer     │    ├RealityBody     │    └RealityCamera     │    └RealOrientation     │    └GroundCheck     └NoclipPlayer            └NoclipCamera

Also the ground check is empty but it is used for some check on the movement

TizioMaurizio commented 1 year ago

@TizioMaurizio I was obliged to add again Reality orientation object on the RealityPlayer. I know that is empty end it can be avoided, but with this object we have a more fluid movement of the player and of the view. Now the hyerarchy is: AllPlayer     ├RealityPlayer     │    ├RealityBody     │    └RealityCamera     │    └RealOrientation     │    └GroundCheck     └NoclipPlayer            └NoclipCamera

Also the ground check is empty but it is used for some check on the movement

as long as it's coherent with the reality/noclip separation anything can be added in my opinion hahahah