Better torque things
This commit is contained in:
1 parent
c679b5a639
commit
8a4009adf8
2 files changed
+45
-7
No files matched your search
@@ -20,15 +20,19 @@ func _physics_process(delta):
|
||||
|
||||
var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y)
|
||||
|
||||
var _should_fix_torque = false
|
||||
|
||||
for body in get_colliding_bodies():
|
||||
if body.name == "StaticBody":
|
||||
if current_angle > 0.3:
|
||||
apply_torque_impulse(rot_vector * current_angle * 7)
|
||||
apply_impulse(transform.basis.xform(Vector3.ZERO), -(transform.basis.y) * 0.05)
|
||||
elif current_angle > 0.05:
|
||||
apply_torque_impulse(-(rot_vector * current_angle * 5))
|
||||
else:
|
||||
angular_velocity = Vector3.ZERO
|
||||
_should_fix_torque = true
|
||||
|
||||
if _should_fix_torque:
|
||||
if current_angle > 0.3:
|
||||
apply_torque_impulse(rot_vector * current_angle * 7)
|
||||
apply_impulse(transform.basis.xform(Vector3.ZERO), -(transform.basis.y) * 0.05)
|
||||
|
||||
if current_angle < 0.1:
|
||||
angular_velocity = Vector3.ZERO
|
||||
|
||||
for axis in angular_velocity:
|
||||
if axis > 10:
|
||||
|
||||
Reference in new issue
Block a user