smooth world grab
else it oscillates badly for some reason. it still kind of does even here, but it's better.
This commit is contained in:
parent
c27c9318cd
commit
1fe3faf4a6
1 changed files with 5 additions and 3 deletions
|
@ -130,9 +130,11 @@ func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bo
|
|||
player_body.rotate_player(angle)
|
||||
|
||||
# Apply scale
|
||||
var new_world_scale := XRServer.world_scale * grab_l2r.length() / pickup_l2r.length()
|
||||
new_world_scale = clamp(new_world_scale, world_scale_min, world_scale_max)
|
||||
XRServer.world_scale = new_world_scale
|
||||
var target_world_scale := XRServer.world_scale * grab_l2r.length() / pickup_l2r.length()
|
||||
target_world_scale = clamp(target_world_scale, world_scale_min, world_scale_max)
|
||||
# lerp a bit. applying the scale directly causes fast oscillations as the
|
||||
# controller positions get scaled to match the world scale.
|
||||
XRServer.world_scale = lerp(XRServer.world_scale, target_world_scale, 0.1)
|
||||
|
||||
# Apply offset
|
||||
offset = pickup_mid - grab_mid
|
||||
|
|
Loading…
Reference in a new issue