Project Settings
Click Config -> Project Settings to open the Project Settings window.
All types inherited from LProjectSettingsBase are listed here.
C++ Loading Method: LWorld::GetProjectSettings
Lua Loading Method: LWorld::GetProjectSetting
The relevant config will be stored in the [project_path]/res/content/config/[module_name]/[class_name].setting file after closing the editing window. Config classes marked with the "Preload" meta will be preloaded when starting the Editor or game.
Effect Quality Config Files
①Click EffectQualitySet tab
②Select the button next to the select box of the Config Map
③Select the folder as needed in the File Browser window
④⑤Select the target config file
⑥Click OK to complete
Multi-Effect Config Presets
Right-click on the EffectQualitySet tab to add a new config or cancel the currently selected preset effect.
Right-click on the config name to delete it or cancel the currently selected preset effect.
Click to select different config names to view the corresponding config details.
Double-click to select different config names to apply the corresponding preset effects.
World Settings
General Project Settings
①User input config file
②Default startup level config
③Property category hidden config file
④Property order config file
⑤Default camera mode (default state of fly mode)
⑥Scene streaming type config
Inputing Configs
- Enable mouse smoothing switch: Control mouse smoothing
- Enable Field of View (FOV) Scale Switch: If enabled, mouse input can be scaled by using the Camera Manager FOV
- Whether to capture the mouse at startup
- FOV Scale Value: FOV scaling coefficient
- Double-click Time: It is considered to be a double-click when the interval between two key inputs is less than this value
- Default mouse capture mode
- Default mouse lock mode
- Axis Property Mapping List: The mapping table of axis logical name and property (e.g. the scaling coefficient of the axis, whether to reverse)
- Combination Key Mapping List: The mapping table of combination logic name and key combination (e.g. "jump"-"SpaceBar")
- Axis Mapping List: The mapping table of the axis logical name and the key (e.g. "move forward"-"W")
Adding/Deleting/Editing the Axis Properties
Adding/Deleting/Editing the Combination Key Mappings
Adding/Deleting/Editing the Axis Mappings
Jumping Example
Players input: Select SpaceBar for the Key Name
Input config: Combination mapping the SpaceBar key to "Jump"
Input Component: Blinding combination mapping callback
C++:
input_character_demo.cpp
void LInputCharacterDemo::SetupPlayerInputComponent(LInputComponent* pIC)
{
Assert(pIC);
{ ... }
{
// Add combination callback
CCombinationCallback& cJumpPressedCC = pIC->TAddCombinationCallback(
"Jump", INPUT_EVENT_ENUM::Pressed,
this, &LInputCharacterDemo::OnJumpPressed);
cJumpPressedCC.bConsumeInput = true;
CCombinationCallback& cJumpReleasedCC = pIC->TAddCombinationCallback(
"Jump", INPUT_EVENT_ENUM::Released,
this, &LInputCharacterDemo::OnJumpReleased);
cJumpReleasedCC.bConsumeInput = true;
}
}Lua:
script_input_character.lua
--use this for initialization
function on_begin_play(component)
local owner = component.GameObjectOwner
if nx_is_valid(owner) then
local input_comp = owner.InputComponent
if nx_is_valid(input_comp) then
nx_bind_script(owner, nx_current())
--Bind axis mapping callback
input_comp:AddAxisBinding("MoveForward", true, false, true, "InputAxisEvent_MoveForward")
input_comp:AddAxisBinding("MoveRight", true, false, true, "InputAxisEvent_MoveRight")
input_comp:AddAxisBinding("Turn", true, false, true, "InputAxisEvent_Turn")
input_comp:AddAxisBinding("LookUp", true, false, true, "InputAxisEvent_LookUp")
--Bind combination mapping callback
input_comp:AddCombinationBinding("Jump", IE_Pressed, true, false, true,
"InputActionEvent_Jump_Pressed")
input_comp:AddCombinationBinding("Jump", IE_Released, true, false, true,
"InputActionEvent_Jump_Released")
--Axis mapping callback
nx_callback(owner, "InputAxisEvent_MoveForward", "on_moveforward")
nx_callback(owner, "InputAxisEvent_MoveRight", "on_moveright")
nx_callback(owner, "InputAxisEvent_Turn", "on_turn")
nx_callback(owner, "InputAxisEvent_LookUp", "on_lookup")
--Combination mapping callback
nx_callback(owner, "InputActionEvent_Jump_Pressed", "on_jump_pressed")
nx_callback(owner, "InputActionEvent_Jump_Released", "on_jump_released")
nx_callback(owner, "on_velocity_changed", "on_velocity_changed")
--Open helper doc when left click up
input_comp:AddCombinationBinding("LeftClick", IE_Pressed, true, false, true,
"InputActionEvent_LeftClick_Pressed")
input_comp:AddCombinationBinding("LeftClick", IE_Released, true, false, true,
"InputActionEvent_LeftClick_Released")
nx_callback(owner, "InputActionEvent_LeftClick_Pressed", "on_leftclick")
nx_callback(owner, "InputActionEvent_LeftClick_Released", "on_leftclick_up")
end
end
nx_callback(component, "on_tick", "tick")
endGame Logic: Processing of the bound callback function
C++:
input_character_demo.cpp
void LInputCharacterDemo::OnJumpPressed()
{
Jump();
}
void LInputCharacterDemo::OnJumpReleased()
{
StopJumping();
}Lua:
script_input_character.lua
--use this for initialization
function on_begin_play(component)
local owner = component.GameObjectOwner
if nx_is_valid(owner) then
local input_comp = owner.InputComponent
if nx_is_valid(input_comp) then
nx_bind_script(owner, nx_current())
--Bind axis mapping callback
input_comp:AddAxisBinding("MoveForward", true, false, true, "InputAxisEvent_MoveForward")
input_comp:AddAxisBinding("MoveRight", true, false, true, "InputAxisEvent_MoveRight")
input_comp:AddAxisBinding("Turn", true, false, true, "InputAxisEvent_Turn")
input_comp:AddAxisBinding("LookUp", true, false, true, "InputAxisEvent_LookUp")
--Bind combination mapping callback
input_comp:AddCombinationBinding("Jump", IE_Pressed, true, false, true,
"InputActionEvent_Jump_Pressed")
input_comp:AddCombinationBinding("Jump", IE_Released, true, false, true,
"InputActionEvent_Jump_Released")
--Axis mapping callback
nx_callback(owner, "InputAxisEvent_MoveForward", "on_moveforward")
nx_callback(owner, "InputAxisEvent_MoveRight", "on_moveright")
nx_callback(owner, "InputAxisEvent_Turn", "on_turn")
nx_callback(owner, "InputAxisEvent_LookUp", "on_lookup")
--Combination mapping callback
nx_callback(owner, "InputActionEvent_Jump_Pressed", "on_jump_pressed")
nx_callback(owner, "InputActionEvent_Jump_Released", "on_jump_released")
nx_callback(owner, "on_velocity_changed", "on_velocity_changed")
--Open helper doc when left click up
input_comp:AddCombinationBinding("LeftClick", IE_Pressed, true, false, true,
"InputActionEvent_LeftClick_Pressed")
input_comp:AddCombinationBinding("LeftClick", IE_Released, true, false, true,
"InputActionEvent_LeftClick_Released")
nx_callback(owner, "InputActionEvent_LeftClick_Pressed", "on_leftclick")
nx_callback(owner, "InputActionEvent_LeftClick_Released", "on_leftclick_up")
end
end
nx_callback(component, "on_tick", "tick")
end--Jump key pressed callback
function on_jump_pressed(owner)
if nx_find_custom(owner, "JumpAgainLock") and owner.JumpAgainLock then
return 1
end
--Character jumping
owner:Jump()
return 1
end
Moving Forward Example
Players input: Select W key for the Key Name
Input Config: Axis mapping W key to MoveForward
Input Component: Binding axis mapping callback
C++:
input_character_demo.cpp
void LInputCharacterDemo::SetupPlayerInputComponent(LInputComponent* pIC)
{
Assert(pIC);
{
// Add axis callback
CAxisCallback& cMoveForwardAC = pIC->TAddAxisCallback("MoveForward",
this, &LInputCharacterDemo::OnMoveForward);
cMoveForwardAC.bConsumeInput = true;
CAxisCallback& cMoveRightAC = pIC->TAddAxisCallback("MoveRight",
this, &LInputCharacterDemo::OnMoveRight);
cMoveRightAC.bConsumeInput = true;
CAxisCallback& cTurnAC = pIC->TAddAxisCallback("Turn",
this, &LInputCharacterDemo::OnTurn);
cTurnAC.bConsumeInput = true;
CAxisCallback& cLookUpAC = pIC->TAddAxisCallback("LookUp",
this, &LInputCharacterDemo::OnLookUp);
cLookUpAC.bConsumeInput = true;
}
{ ... }
}Lua:
script_input_character.lua
local IE_MAX = 5
---------------------
--default callbacks--
---------------------
--use this for initialization
function on_begin_play(component)
local owner = component.GameObjectOwner
if nx_is_valid(owner) then
local input_comp = owner.InputComponent
if nx_is_valid(input_comp) then
nx_bind_script(owner, nx_current())
--Bind axis mapping callback
input_comp:AddAxisBinding("MoveForward", true, false, true, "InputAxisEvent_MoveForward")
input_comp:AddAxisBinding("MoveRight", true, false, true, "InputAxisEvent_MoveRight")
input_comp:AddAxisBinding("Turn", true, false, true, "InputAxisEvent_Turn")
input_comp:AddAxisBinding("LookUp", true, false, true, "InputAxisEvent_LookUp")
--Bind combination mapping callback
input_comp:AddCombinationBinding("Jump", IE_Pressed, true, false, true,
"InputActionEvent_Jump_Pressed")
input_comp:AddCombinationBinding("Jump", IE_Released, true, false, true,
"InputActionEvent_Jump_Released")
--Axis mapping callback
nx_callback(owner, "InputAxisEvent_MoveForward", "on_moveforward")
nx_callback(owner, "InputAxisEvent_MoveRight", "on_moveright")
nx_callback(owner, "InputAxisEvent_Turn", "on_turn")
nx_callback(owner, "InputAxisEvent_LookUp", "on_lookup")
--Combination mapping callback
nx_callback(owner, "InputActionEvent_Jump_Pressed", "on_jump_pressed")
nx_callback(owner, "InputActionEvent_Jump_Released", "on_jump_released")
nx_callback(owner, "on_velocity_changed", "on_velocity_changed")Game Logic: Processing of the bound callback function
C++:
input_character_demo.cpp
void LInputCharacterDemo::OnMoveForward(float val)
{
LController* pController = GetController();
if (pController != NULL)
{
CXMVECTOR vAngle = pController->GetAngle();
AddMovementInput(FXMath::AngleGetForward(vAngle), val);
}
}Lua:
script_input_character.lua
--use this for initialization
function on_begin_play(component)
local owner = component.GameObjectOwner
if nx_is_valid(owner) then
local input_comp = owner.InputComponent
if nx_is_valid(input_comp) then
nx_bind_script(owner, nx_current())
--Bind axis mapping callback
input_comp:AddAxisBinding("MoveForward", true, false, true, "InputAxisEvent_MoveForward")
input_comp:AddAxisBinding("MoveRight", true, false, true, "InputAxisEvent_MoveRight")
input_comp:AddAxisBinding("Turn", true, false, true, "InputAxisEvent_Turn")
input_comp:AddAxisBinding("LookUp", true, false, true, "InputAxisEvent_LookUp")
--Bind combination mapping callback
input_comp:AddCombinationBinding("Jump", IE_Pressed, true, false, true,
"InputActionEvent_Jump_Pressed")
input_comp:AddCombinationBinding("Jump", IE_Released, true, false, true,
"InputActionEvent_Jump_Released")
--Axis mapping callback
nx_callback(owner, "InputAxisEvent_MoveForward", "on_moveforward")
nx_callback(owner, "InputAxisEvent_MoveRight", "on_moveright")
nx_callback(owner, "InputAxisEvent_Turn", "on_turn")
nx_callback(owner, "InputAxisEvent_LookUp", "on_lookup")
--Combination mapping callback
nx_callback(owner, "InputActionEvent_Jump_Pressed", "on_jump_pressed")
nx_callback(owner, "InputActionEvent_Jump_Released", "on_jump_released")
nx_callback(owner, "on_velocity_changed", "on_velocity_changed")--Move forward callback
function on_moveforward(owner, axis_value)
if not nx_is_valid(owner) then
return 0
end
--Get controller Y-axis angle
local controller = owner.Controller
if nx_is_valid(controller) then
local yaw = controller.AngleY
--Get forward direction
local x, y, z = nx_function("ext_angle_get_forward_vector", 0.0, yaw, 0.0)
--Add movement
owner:AddMovementInput(x, y, z, axis_value)
end
return 1
end