Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends RigidBody
- class_name Interactive
- var target = null
- var velocity = Vector3()
- func _physics_process(_delta):
- if target:
- self.linear_velocity = (target.global_transform.origin - global_transform.origin) * 5
- #global_transform = global_transform.interpolate_with(target.global_transform, delta * 15)
- func take(_target):
- target = _target
- mode = RigidBody.MODE_RIGID
- func drop():
- target = null
- mode = RigidBody.MODE_RIGID
- var dir = transform.basis.z
- apply_central_impulse(dir * -1)
- func push():
- target = null
- mode = RigidBody.MODE_RIGID
- var dir = GlobalGd.player.head.global_transform.basis.z
- dir = dir.rotated(Vector3.UP, 0.1)
- dir.y -= 0.2
- apply_central_impulse(dir * -10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement