Garry's Mod
VRMod_x64 - Extended
 กระทู้นี้ถูกปักหมุด เพราะฉะนั้นอาจเป็นกระทู้สำคัญ
Doom Slayer  [ผู้พัฒนา] 12 ก.ค. @ 5: 33am
DEV ZONE
Added VRmod API functions

vrmod.SetViewModelFixMuzzle(classname, bool)

What: Enables/disables muzzle angle fix for SWEP’s viewmodel in VR.

Args: classname (string, e.g., "weapon_crowbar"), bool (true/false).

Example

vrmod.SetViewModelFixMuzzle("weapon_crowbar", true) -- Fix muzzle for crowbar

vrmod.SetViewModelNoLaser(classname, bool)

What: Disables laser pointer for SWEP in VR.

Args: classname (string), bool (true/false).

Example:

vrmod.SetViewModelNoLaser("weapon_crowbar", true) -- Disable laser for crowbar

vrmod.GetHeldEntity(ply, hand)

What: Returns entity held in player’s VR hand.

Args: ply (Entity, player), hand (string, "left" or "right").

Returns: Entity or nil if none held.

Example:

local held = vrmod.GetHeldEntity(LocalPlayer(), "right") if IsValid(held) then print("Holding:", held:GetClass()) end
แก้ไขล่าสุดโดย Doom Slayer; 12 ก.ค. @ 5: 42am
< >
กำลังแสดง 1-1 จาก 1 ความเห็น
Doom Slayer  [ผู้พัฒนา] 12 ก.ค. @ 5: 36am 
SWEP integration with the VRMod's Melee System


VRMod_MeleeSwing (Client)Customize swing sounds/effects when swinging (no hit required).

When: Triggers on swing if velocity > vrmod_melee_velthreshold (default 1.5 m/s).
Args:swingData: { Player, Weapon, Hand ("left"/"right"/nil), Position (Vector), RelativeVelocity (Vector), RelativeSpeed (number) }
callback: Call callback(soundPath) to set swing sound.

Default: Plays Weapon_Crowbar.Single for crowbar.

Example: Stunstick Swing

if CLIENT then hook.Add("VRMod_MeleeSwing", "StunstickSwing", function(swingData, callback) if swingData.Weapon:GetClass() == "weapon_stunstick" then callback("Weapon_StunStick.Activate") -- swing sound end end) end

VRMod_MeleeHit (Server)Customize hit sound, damage, decals, etc., when swing hits.

When: Triggers on hit (entity or surface).
Args:hitData: { Attacker, HitEntity, HitPos, Damage, ImpactType, Hand, RelativeSpeed, MaterialType, DecalName, DamageMultiplier, DamageType, Reach, Radius }
callback: Call callback(soundPath, decal, damage, multiplier, damageType, reach, radius, impactType) to override.

Default: Uses impactSounds[impactType] (e.g., blunt), material-based decals, ~100–500 damage.


if SERVER then hook.Add("VRMod_MeleeHit", "SwordHit", function(hitData, callback) if hitData.Attacker:GetActiveWeapon():GetClass() == "weapon_mysword" then callback("weapons/kn!fe/knife_hit1.wav", "Impact.Flesh", nil, 1.5, DMG_SLASH, hitData.Reach * 1.2, nil, "sharp") end end) end

Example[github.com]

Example 2[github.com]

Relevant code[github.com]
แก้ไขล่าสุดโดย Doom Slayer; 15 ก.ค. @ 3: 15am
< >
กำลังแสดง 1-1 จาก 1 ความเห็น
ต่อหน้า: 1530 50