Function _IrrAddFPSCamera

au3Irr2

au3Irr2 Function Reference

_IrrAddFPSCamera

Adds a 'first person shooter' style camera with mouse and keyboard control into the scene.

#Include <au3Irrlicht2.au3>
_IrrAddFPSCamera($h_ParentNode = 0, $f_RotateSpeed = 100.0, $f_MoveSpeed = 0.5, $i_ID = -1, $h_KeyMapArray = 0, $i_KeyMapSize = 0, $i_NoVerticalMovement = 0, $f_JumpSpeed = 0.0)

 

Parameters

$h_ParentNode [optional] Parent scene node of the camera. Can be null.
$f_RotateSpeed [optional] Speed in degress with which the camera is rotated. This can be done only with the mouse.
$f_MoveSpeed [optional] Speed in units per millisecond with which the camera is moved. Movement is done with the cursor keys.
$i_ID [optional] id of the camera. This id can be used to identify the camera.
$h_KeyMapArray [optional] Adress of a key map as created with __CreatePtrKeyMapArray, specifying what keys should be used to move the camera. If this is null, the default keymap is used.
You can define actions more then one time in the array, to bind multiple keys to the same action.
$i_KeyMapSize [optional] Amount of items in the keymap array.
$b_NoVerticalMovement [optional] Setting this to true makes the camera only move within a horizontal plane, and disables vertical movement as known from most ego shooters.
Default is 'false', with which it is possible to fly around in space, if no gravity is there.
$f_JumpSpeed [optional] Speed with which the camera is moved when jumping.

 

Return Value

Success: Handle of the camera object
Failure: False

 

Remarks

Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
If however you capture events when starting irrlicht this will become a normal camera that can only be moved by code.
This FPS camera is intended to provide a demonstration of a camera that behaves like a typical First Person Shooter.
It is useful for simple demos and prototyping but is not intended to provide a full solution for a production quality game.
It binds the camera scene node rotation to the look-at target.

 

Related

__CreatePtrKeyMapArray, _IrrAddCamera, _IrrAddMayaCamera

 

Example


#include "au3Irrlicht2.au3"

_IrrStart()

local $camera = _IrrAddFPSCamera()

local $mesh = _IrrGetMesh( ".\media\capsuleX.obj" )
local $sceneNode = _IrrAddMeshToScene( $mesh )
_IrrSetNodePosition($sceneNode, 0, 0, 5 )

local $texture = _IrrGetTexture(".\media\default_texture.png")
_IrrSetNodeMaterialTexture( $sceneNode, $texture, 0)
_IrrSetNodeMaterialFlag( $sceneNode, $IRR_EMF_LIGHTING, $IRR_OFF )

_IrrSetWindowCaption("Move with mouse + cursor keys - quit with ALT-F4!")
WHILE _IrrRunning()
    _IrrBeginScene(50, 50, 50)
    _IrrDrawScene()
    _IrrEndScene()
WEND

_IrrStop()