peng3d.actor.player - Player Actors

class peng3d.actor.player.BasicPlayer(peng, world, uuid=None, pos=[0, 0, 0], rot=[0, 0])[source]

Basic Player class, subclass of RotatableActor().

This class adds no features currently, it can be used to identify player actors via isinstance().

class peng3d.actor.player.FirstPersonPlayer(peng, world, uuid=None, pos=[0, 0, 0], rot=[0, 0])[source]

Old class allowing to create standard first-person players easily.

Deprecated:See EgoMouseRotationalController() and FourDirectionalMoveController() instead
get_motion_vector()[source]

Returns the movement vector according to held buttons and the rotation.

Returns:3-Tuple of (dx,dy,dz)
Return type:tuple
update(dt)[source]

Internal method used for moving the player.

Parameters:dt (float) – Time delta since the last call to this method
class peng3d.actor.player.FourDirectionalMoveController(*args, **kwargs)[source]

Controller allowing the user to control the actor with the keyboard.

You can configure the used keybinds with the controls.controls.forward etc. The keybinds can also be changed with their keybindname, e.g. peng3d:actor.<actor uuid>.player.controls.forward for forward.

The movement speed may also be changed via the movespeed instance attribute, which defaults to controls.controls.movespeed.

You may also access the currently held keys via move, which is a list with 2 items, forwards/backwards and left/right.

get_motion_vector()[source]

Returns the movement vector according to held buttons and the rotation.

Returns:3-Tuple of (dx,dy,dz)
Return type:tuple
registerEventHandlers()[source]

Registers needed keybinds and schedules the update() Method.

You can control what keybinds are used via the controls.controls.forward etc. Configuration Values.

update(dt)[source]

Should be called regularly to move the actor.

This method does nothing if the enabled property is set to false.

Note that this method is called automatically and should not be manually called.

class peng3d.actor.player.EgoMouseRotationalController(*args, **kwargs)[source]

Controller allowing the user to rotate the actor with the mouse.

registerEventHandlers()[source]

Registers the motion and drag handlers.

Note that because of the way pyglet treats mouse dragging, there is also an handler registered to the on_mouse_drag event.

class peng3d.actor.player.BasicFlightController(*args, **kwargs)[source]

Controller allowing the user to move up and down with the jump and crouch controls.

The used keybinds may be configured via controls.controls.crouch and controls.controls.jump.

The vertical speed used when flying may be configured via controls.controls.verticalspeed or the speed attribute.

registerEventHandlers()[source]

Registers the up and down handlers.

Also registers a scheduled function every 60th of a second, causing pyglet to redraw your window with 60fps.

update(dt)[source]

Should be called regularly to move the actor.

This method does nothing if the enabled property is set to False.

This method is called automatically and should not be called manually.