Better torque things

This commit is contained in:
karl 2020-02-02 14:36:16 +01:00
parent c679b5a639
commit 8a4009adf8
2 changed files with 45 additions and 7 deletions

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/huhntextur.png-a31af8e4947b19bec12f70e34f5f09d2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://3D Input/huhntextur.png"
dest_files=[ "res://.import/huhntextur.png-a31af8e4947b19bec12f70e34f5f09d2.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -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: