Garry's Mod
29 คะแนน
VRMod Lua documentation
โดย Catse
   
รางวัล
ชื่นชอบ
ชื่นชอบแล้ว
เลิกชื่นชอบ
Shared Functions
Note: player defaults to localplayer on the client
Note: Get* functions never return nil. An invalid position or angle is returned as 0,0,0.

Name: vrmod.IsPlayerInVR( player )
Returns: boolean

Name: vrmod.UsingEmptyHands( player )
Returns: boolean

Name: vrmod.GetHMDPos( player )
Returns: vector

Name: vrmod.GetHMDAng( player )
Returns: angle

Name: vrmod.GetHMDPose( player )
Returns: vector, angle

Name: vrmod.GetLeftHandPos( player )
Returns: vector

Name: vrmod.GetLeftHandAng( player )
Returns: angle

Name: vrmod.GetLeftHandPose( player )
Returns: vector, angle

Name: vrmod.GetRightHandPos( player )
Returns: vector

Name: vrmod.GetRightHandAng( player )
Returns: angle

Name: vrmod.GetRightHandPose( player )
Returns: vector, angle
Clientside Functions
Name: vrmod.GetHMDVelocity()
Returns: vector

Name: vrmod.GetHMDAngularVelocity()
Returns: vector

Name: vrmod.GetHMDVelocities()
Returns: vector, vector

Name: vrmod.GetLeftHandVelocity()
Returns: vector

Name: vrmod.GetLeftHandAngularVelocity()
Returns: vector

Name: vrmod.GetLeftHandVelocities()
Returns: vector, vector

Name: vrmod.GetRightHandVelocity()
Returns: vector

Name: vrmod.GetRightHandAngularVelocity()
Returns: vector

Name: vrmod.GetRightHandVelocities()
Returns: vector

Name: vrmod.SetLeftHandPose( vector pos, angle ang )
Returns:
Description: Used to override the position and angle of the players hand. This should be called in the VR PreRender hook.

Name: vrmod.SetRightHandPose( vector pos, angle ang )
Returns:

Name: vrmod.GetDefaultLeftHandOpenFingerAngles()
Returns: table

Name: vrmod.GetDefaultLeftHandClosedFingerAngles()
Returns: table

Name: vrmod.GetLeftHandOpenFingerAngles()
Returns: table

Name: vrmod.GetLeftHandClosedFingerAngles()
Returns: table

Name: vrmod.GetDefaultRightHandOpenFingerAngles()
Returns: table

Name: vrmod.GetDefaultRightHandClosedFingerAngles()
Returns: table

Name: vrmod.GetRightHandOpenFingerAngles()
Returns: table

Name: vrmod.GetRightHandClosedFingerAngles()
Returns: table

Name: vrmod.SetLeftHandOpenFingerAngles( table )
Returns:

Name: vrmod.SetLeftHandClosedFingerAngles( table )
Returns:

Name: vrmod.SetRightHandOpenFingerAngles( table )
Returns:

Name: vrmod.SetRightHandClosedFingerAngles( table )
Returns:

Name: vrmod.GetLeftHandFingerAnglesFromModel( string model, number sequence )
Returns: table

Name: vrmod.GetRightHandFingerAnglesFromModel( string model, number sequence )
Returns: table

Name: vrmod.GetLeftHandPoseFromModel( string model, number sequence, string refBoneName )
Returns: vector, angle

Name: vrmod.GetRightHandPoseFromModel( string model, number sequence, string refBoneName )
Returns: vector, angle

Name: vrmod.GetLerpedFingerAngles( number fraction, table from, table to )
Returns: table

Name: vrmod.GetLerpedHandPose( number fraction, vector fromPos, angle fromAng, vector toPos, vector toAng )
Returns: vector, angle

Name: vrmod.SetViewModelOffsetForWeaponClass( string class, vector offsetPos, angle offsetAng )
Returns:
Description: You shouldn't use this. Normally viewmodel offsets get automatically set based on the hand pose built into the model.

Name: vrmod.GetInput( string ActionName )
Returns: boolean/number/table
Description: Returns the current state of specified controller input action. The default action names are: boolean_primaryfire, vector1_primaryfire, boolean_secondaryfire, boolean_changeweapon, boolean_use, boolean_spawnmenu, vector2_walkdirection, boolean_walk, boolean_flashlight, boolean_turnleft, boolean_turnright, vector2_smoothturn, boolean_chat, boolean_reload, boolean_jump, boolean_left_pickup, boolean_right_pickup, boolean_undo, boolean_sprint, vector1_forward, vector1_reverse, boolean_turbo, vector2_steer, boolean_handbrake, boolean_exit, boolean_turret
note: these names are not guaranteed and may change in the future

Name: vrmod.MenuCreate( string UID, number Width, number Height, panel Panel, number Attachment, vector Pos, angle Ang, number Scale, boolean CursorEnabled, function CloseFunc )
Returns:
Description: Displays a menu in VR using the built-in menu system. Panel can be set to an existing derma panel or nil. If nil, manual rendering to the menu's RT is used instead. When using a panel its position should be set to 0,0 beforehand.
Attachment number determines what Pos and Ang are relative to, 0: World, 1: Left hand,
2: Right hand, 3: HMD, 4: Playspace.

Name: vrmod.MenuClose( string UID )
Returns:
Description: Closes a menu previously opened with vrmod.MenuCreate. Note that if a derma panel was used, this will not automatically remove/close the panel, it will only stop displaying it as a VR menu. You should perform appropriate cleanup in the CloseFunc supplied during menu creation.

Name: vrmod.MenuExists( string UID )
Returns: boolean
Description: Returns true if a menu with the specified UID exists.

Name: vrmod.MenuRenderStart( string UID )
Returns:
Description: If manual rendering is used instead of a derma panel, this function is
used to start rendering to the menu. After calling this a 2D rendering context is
active.

Name: vrmod.MenuRenderEnd()
Returns:
Description: Call after you're done manually rendering to the menu.

Name: vrmod.MenuCursorPos()
Returns: number, number
Description: Returns X and Y cursor position within currently focused menu

Name: vrmod.MenuFocused()
Returns: string
Description: Returns UID of currently focused menu

Name: vrmod.AddLocomotionOption( name, startFunc, stopFunc, buildCPanelFunc )
Returns:
Description: Adds a new locomotion option to the vrmod menu. BuildCPanelFunc receives a DPanel as the first argument. Controls for configuring the locomotion option can be added to this panel. Keep in mind that the locomotion system should be able to handle being started/stopped seamlessly.

Name: vrmod.StartLocomotion()
Returns:
Description: Starts the locomotion system currently selected by the user

Name: vrmod.StopLocomotion()
Returns:
Description: Stops the locomotion system currently selected by the user.

Name: vrmod.GetOriginPos()
Returns: vector

Name: vrmod.GetOriginAng()
Returns: angle

Name: vrmod.GetOrigin()
Returns: vector, angle
Description: Gets the position and angle of the user's VR playspace in the game world

Name: vrmod.SetOrigin( pos, ang )
Returns:
Description: Sets the position and angle of the user's VR playspace in the game world. Can be used by locomotion systems to move the VR view. Note that the physical gmod player should be moved separately to synchronize its position with the vr user's location

Name: vrmod.SetOriginPos( vector pos )
Returns:

Name: vrmod.SetOriginAng( angle ang )
Returns:

Name: vrmod.AddInGameMenuItem( string name, number slot, number slotpos, func )
Returns:
Description: Can be used to add new items to the in-game vr quickmenu.

Name: vrmod.RemoveInGameMenuItem( string name )
Returns:
Description:

Name: vrmod.GetEyePos( )
Returns: vector
Description: Returns position of the eye that is currently being used for rendering.

Name: vrmod.GetLeftEyePos( )
Returns: vector
Description:

Name: vrmod.GetRightEyePos( )
Returns: vector
Description:

Name: vrmod.GetTrackedDeviceNames( )
Returns: table
Description:
Shared Hooks
Name: VRMod_Start( player )
Description: Called when a player enters VR

Name: VRMod_Exit( player )
Description: Called when a player exits VR

Name: VRMod_Pickup( player, entity )
Description: Called when a vr player picks up an entity. Return false on the server to
block the action.

Name: VRMod_Drop( player, entity )
Description: Called when a vr player drops an entity.
Clientside Hooks
Name: VRMod_Input( string ActionName, boolean State )
Description: This gets called every time a boolean controller input action changes state

Name: VRMod_AllowDefaultAction( string ActionName )
Description: Returning false in this hook can be used to block the vrmod addon's
default behaviour for this action

Name: VRMod_PreRender
Description: Called before rendering the game. Any code that you want to run once per
frame should be put here.

Name: VRMod_PreRenderRight
Description: Called before rendering the right eye. This along with the previous hook
can be used to render different things in different eyes.

Name: VRMod_PostRender
Description: Called after rendering the game.

Name: VRMod_OpenQuickMenu
Description: Called when attempting to open the in-game vr quickmenu. Returning false in this hook blocks the action.

7 ความเห็น
Carl Brutananadilewski 17 ก.ย. 2023 @ 11: 28pm 
sometimes the keybind one returns as nil. is there a reason why?
wolfee0507 10 ก.ค. 2022 @ 2: 38am 
module?
ganzaliss 4 ก.พ. 2022 @ 2: 18am 
Hello I cant play gamod in vr please help.
gtfyhbvjrunrbd[3050] 27 เม.ย. 2021 @ 9: 05am 
w
Bbop 1 ก.พ. 2021 @ 5: 37pm 
epic
slashii_ 11 พ.ย. 2020 @ 10: 16am 
vr?
coolreally 16 มิ.ย. 2020 @ 4: 24pm 
cool