Make gamepad vibration work on web export
Input.start_joy_vibration() is a documented engine no-op on Godot's HTML5 export (never wired to the browser side). Controls.vibrate() wraps it: native platforms go straight through as before, web drives the browser's Gamepad Haptic Actuator API directly via JavaScriptBridge. Gamepad movement/ability input already worked on desktop browsers via the standard Web Gamepad API, so only vibration needed a fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MXBNaEBmrYDSMcv4NgUWtV
This commit is contained in:
@@ -835,9 +835,8 @@ func take_sword_hit(cause: String = "", hit_pos: Vector3 = Vector3.ZERO) -> void
|
||||
health_changed.emit(_hp, _max_hp)
|
||||
hit_taken.emit(cause)
|
||||
camera_pivot.call(&"trigger_hit", 0.7)
|
||||
# Vibrate controller 0 with half weak strength, full strong strength, for 0.5 seconds
|
||||
if DP.b("gamepad_vibration"):
|
||||
Input.start_joy_vibration(0, 0.5, 1, 0.2)
|
||||
# Vibrate controller 0 with half weak strength, full strong strength, for 0.2 seconds
|
||||
Controls.vibrate(0, 0.5, 1, 0.2)
|
||||
|
||||
# A spear gores a spot — blood spurts from the entry wound (where it struck the
|
||||
# bull). Melee gores pass no position and skip the spurt; gore can be turned off.
|
||||
|
||||
Reference in New Issue
Block a user