File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Assets/UnitySensors/Runtime/Scripts/Sensors/IMU Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -48,24 +48,26 @@ protected override void Init()
4848 _gravityMagnitude = Physics . gravity . magnitude ;
4949 }
5050
51- private void FixedUpdate ( )
51+ protected override void Update ( )
5252 {
53- float dt = Time . fixedDeltaTime ;
53+ float dt = Time . deltaTime ;
5454
5555 _position_tmp = _transform . position ;
5656 _velocity_tmp = ( _position_tmp - _position_last ) / dt ;
5757 _acceleration_tmp = ( _velocity_tmp - _velocity_last ) / dt ;
5858 _acceleration_tmp -= _transform . InverseTransformDirection ( _gravityDirection ) * _gravityMagnitude ;
5959
6060 _rotation_tmp = _transform . rotation ;
61- Quaternion rotation_delta = Quaternion . Inverse ( _rotation_last ) * _rotation ;
61+ Quaternion rotation_delta = Quaternion . Inverse ( _rotation_last ) * _rotation_tmp ;
6262 rotation_delta . ToAngleAxis ( out float angle , out Vector3 axis ) ;
6363 float angularSpeed = ( angle * Mathf . Deg2Rad ) / dt ;
6464 _angularVelocity_tmp = axis * angularSpeed ;
6565
6666 _position_last = _position_tmp ;
6767 _velocity_last = _velocity_tmp ;
6868 _rotation_last = _rotation_tmp ;
69+
70+ base . Update ( ) ;
6971 }
7072
7173 protected override void UpdateSensor ( )
You can’t perform that action at this time.
0 commit comments