CarrotKutay/Colosseum

Addition physics based movement : Straigthen entity back up / controlled fall

Closed this issue · 3 comments

Controlled fall / Straighten back up / Standing up

Due to entities now having angular velocity applied to them when they are either colliding with objects or are falling/jumping into free fall, they experience situations where movement after such moments is impaired due to their physical bodies being positioned in ways that the movements intended are not possible anymore.

Possible Solution

A automatic standing / straightening-up / controlled fall enhancement is needed for entities mirroring behavior of animate objects to straighten up into a position that allows for further movement

what is most likely gonna be working is some sort of control system. This control system can do the following:

  • pick out relevant entities for control
  • control angular velocity of all those entities. Angular.x and Angular.z should be controlled by following conditions
    1. the entity to be controlled is not currently touching the ground (e.g. another object)
    2. the downwards vector is hitting a surface. Then surface normal can be used as orientation for new up vector

what is most likely gonna be working is some sort of control system. This control system can do the following:

* pick out relevant entities for control

* control angular velocity of all those entities. Angular.x and Angular.z should be controlled by following conditions
  
  1. the entity to be controlled is not currently touching the ground (e.g. another object)
  2. the downwards vector is hitting a surface. Then surface normal can be used as orientation for new up vector

it becomes apparent that trying to directly influence physics is a bad call (at least with my limited mathematical know-how) therefore, I will try a new approach: control the entity only when a certain angle between surface vector and entity upwards vector is reached (e.g. lets take 45 degrees) and perform inverted x and z axis angular rotation force

Concept for angular force control system:

Update v0.2.2

  • Measurement direction (+ / -) will be updated as long as reset is not needed
  • Once reset is needed direction will be taken from last measurement
  • Same direction will used for control until reset on axis is finished
  • added control speed (rotation force should be reasonably fast even if measurement difference is minimal but still in need of control) -> therefore, control speed is depending on measurement difference
    • case A: measurement difference is big -> control speed will be (close to) =1
    • case B: measurement difference is small -> control speed will be (close to) =3 (upper bound of control speed)

Update v0.2.1

  • Control measuring should/needs to be done continuously
  • Once measurement reaches a certain threshold, control force is given permission to control axis needed
  • Control is directed by the difference in radiance between surface normal and player normal / up vector

Todo:

  • add permission bool-value to angular force control component
  • check if several axis can be controlled simultaneously or if they need to be controlled serially -> it is possible to do so simultaneously