Player

When in Winds3D Player, press Shift + F to toggle off Free View Mode, the program will invent a player let you walk around in virtual world. The player will blocked by walls, fall from high, upstairs, jump, duck, etc, act like familiar 3D game. The player' body is looked as a box (see illustration above) in program. Player's default body height is 170 cm, body width is 40 cm, and maximal stairstep height is 20 cm.  You can change player's body size in Install scene Dialog.

You can control more by the script class player, like setting position, velocity, etc. The player have a corresponding movtar, you can get it by the player.getMovTar() function. The player class have two callback functions: OnLanding() and OnFlying(), respectively called by the program when the player landing or flying-off.

If the player stand on a movable object, then the player will transferred by it. But there is a console variable 'p_vehicle' to control this feature on/off.

Example :

-- disable default controls and custom own controls for player

EnableAccel(false)
SetInputStyle(NULL)

function OnKeyDown(nChar)
    local ch=string.char(nChar)

    if (VK_SPACE==nChar) then player.jump() end

    local vfront=camera.getFront()
    vfront.y=0
    vfront.normalize()

    if ('W'==ch) then player.go(vfront*50) end
    if ('S'==ch) then player.go(-vfront*50) end
end

function FrameMove()
    if (wnd.IsKeyDown(string.byte('Z'))) then
        player.duck()
    else
        player.stand()
    end
    camera.setPosition(player.getEyePos())
end

-- play a sound when player landing
player.OnLanding = function()
    PlaySound('\\landing.wav')
end