VDP-noclip / noclip

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

Clean up AllPlayer, it will fix the problem with too angled slopes #32

Closed TizioMaurizio closed 2 years ago

TizioMaurizio commented 2 years ago

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.

Then another question is whether it is better to put RealityCamera and the couple RealityOrientation-RealityCameraPos under the same object not to create confusion, we could do this by splitting AllPlayer differently, that is into RealityPlayer and NoclipPlayer before it is too late.
Suggested gerarchy:

AllPlayer     ├RealityPlayer     │    ├RealityBody     │    └RealityCamera     └NoclipPlayer            └NoclipCamera

Last but not least we should change the tag assigned to RealityBody, because tagging it 'RealityPlayer' can create a lot of confusion since it is the name of its parent, RealityPlayer

---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)

bottolo commented 2 years ago

Okay, I'm going to try your build and then if everything works accordingly I'll close the issue.

On the other hand, though, if you want to change the actual tags I suggest you do so before merging. I think we can all agree that a clearer tag is a synonym of clearer intentions.

TizioMaurizio commented 2 years ago

check out first the new AllPlayer prefab in the prefab-update branch because in develop i forgot to update the prefab

bottolo commented 2 years ago

I placed the AllPlayer prefab but there's this strange issue where the player's capsule body is seen in the distance after respawning, in addition to the usual respawn bug...

TizioMaurizio commented 2 years ago

check out first the new AllPlayer prefab in the prefab-update branch because in develop i forgot to update the p

bottolo commented 2 years ago

Former RealityMovement issue moved to this one after some clearing done with @TizioMaurizio.

stefanofossati commented 2 years ago

@TizioMaurizio, Does this configuration make sense? I think that can be better a the following configuration:

AllPlayer     ├RealityPlayer     │    ├RealityBody     │    └RealityCamera     └NoclipCamera

TizioMaurizio commented 2 years ago

@stefanofossati I would keep a symmetry between RealityPlayer and NoclipPlayer, because noclip mode is not just a camera, it also has its own collider and should have its own character controller.

Otherwise if we want to keep all character control inside one script (is it like this now?) the classes should be all together inside AllPlayer (removing reality player), because just half symmetry can become confusing later on.

The first example I can think of is that we would end up with reality camera having no colliders and noclip camera having colliders, whereas a person, seeing camera in the name, would think they are quite similar concepts.

stefanofossati commented 2 years ago

@TizioMaurizio I have thought about that configuration because the noclipCamera hasn't a body. So it makes sense from my side. If you prefers to have a symmetry I add the noclipPlayer but I think that it wll be empty, without scripts.

TizioMaurizio commented 2 years ago

@stefanofossati I see your motivation about noclip not having a body, the thing is that it just recently started having a collider and it should have some controls of its own instead of offshoring them to realityplayer, also nothing prevents it from receiving more attributes and features later on in the development like it just happened.

My main reasoning is that a camera should just be a camera and any other overhead should remain external, otherwise we could simply give realitycamera a rigid body and collider.

If you anyway remain doubtful we can still discuss it with Samuele and Nicola :-)