An extension of FoxFPSCamera that rotates around the origin instead of being in first person.

The distance can be controlled with the mouse wheel.

Constructor

@:value({ withLightData : true, ortho : false, bgColor : 0x0, z : 0, y : 0, x : 0, dist : -5 })new(dist:Float = -5, x:Float = 0, y:Float = 0, z:Float = 0, bgColor:FlxColor = 0x0, ortho:Bool = false, withLightData:Bool = true)

Variables

distance:Float

Distance from the origin point

@:value(0.5)distanceStep:Float = 0.5

When controlling distance with mouse wheel, this determines how much it increases and decreases

@:value(true)distanceSmoothed:Bool = true

Smooths out the distance transitions

@:value(0.5)distanceSmoothFactor:Float = 0.5

@:value(0)curDistance:Float = 0

Methods

Inherited Variables

Defined by FoxFPSCamera

@:value(true)enableYMovement:Bool = true

If enabled, the camera can go up or down depending on the view angle.

@:value(true)enableKeyboardInput:Bool = true

If true, keyboard inputs wil be used.

Otherwise, you'll need to supply a direction vector via inputDir.

Note: If both keyboard and inputDir are active, the keyboard input will take priority. Useful for debugging.

@:value(true)enableControls:Bool = true

If disabled, all keyboard, inputDir and click+drag inputs will not be processed.

@:value(0.002)sensitivity:Float = 0.002

@:value(5.0)speed:Float = 5.0

@:value(new Vector3D())velocity:Vector3D = new Vector3D()

@:value(new Vector3D())targetAngle:Vector3D = new Vector3D()

@:value(0.5)smoothFactor:Float = 0.5

@:value(-Math.PI / 2)minPitch:Float = -Math.PI / 2

@:value(Math.PI / 2)maxPitch:Float = Math.PI / 2

@:value("W")forwards:String = "W"

@:value("S")backwards:String = "S"

@:value("D")strafeRight:String = "D"

@:value("A")strafeLeft:String = "A"

@:value("SHIFT")run:String = "SHIFT"

@:value(new Vector2())inputDir:Vector2 = new Vector2()

Custom input movement for the camera, set: - x: -1...1 to strafe left and right - y: -1...1 to move forwards or backwards

private@:value(new Vector2())__input:Vector2 = new Vector2()

Defined by FoxCamera

@:value(90)fov:Float = 90

@:value(0.05)near:Float = 0.05

@:value(1000.0)far:Float = 1000.0

@:value(1)aspect:Float = 1

@:value(false)orthogonal:Bool = false

@:value(0x00000000)bgColor:FlxColor = 0x00000000

@:value(1)__aspect:Float = 1

@:value(true)__updateProjection:Bool = true

@:value(0x1)modelLayers:FoxLayer = 0x1

Model visibility layers

@:value([new FoxRenderPass([0], "default")])passes:Array<FoxRenderPass> = [new FoxRenderPass([0], "default")]

Any custom pass you want for this camera, add them here.

By default, there's one pass that will render everything in group 0 on the "default" render target.

Warning! If you create two cameras, make sure to change the output or else it'll overwrite the previous camera render!

@:value(new Matrix3D())viewMatrix:Matrix3D = new Matrix3D()

@:value(new Matrix3D())__invViewMatrix:Matrix3D = new Matrix3D()

@:value(new Matrix3D())projectionMatrix:Matrix3D = new Matrix3D()

@:value(new Matrix3D())__invProjectionMatrix:Matrix3D = new Matrix3D()

@:value(FlxPoint.get(0, 0))projectionOrigin:FlxPoint = FlxPoint.get(0, 0)

Origin of the screen to where a perspective or isometric view would rotate

private@:value(FlxPoint.get(0, 0))__lastProjectionOrigin:FlxPoint = FlxPoint.get(0, 0)

@:value(new Matrix3D())__prevViewMatrix:Matrix3D = new Matrix3D()

This is the view matrix from a previous frame, used for motion vector calculations

@:value(new Matrix3D())final__tempMatrix:Matrix3D = new Matrix3D()

@:value(true)doFrustumCulling:Bool = true

If enabled, this camera will calculate its frustum planes and determine if models are inside it, culling what's outside the view and improving performance.

This is much needed for big worlds and/or small details that are not needed when off-screen

@:value(new FrustumPlanes())frustumPlanes:FrustumPlanes = new FrustumPlanes()

lightData:FoxLightData

The light data associated with this camera.

This handles all dynamic lighting that's visible by this camera, including ambient light.

Normally, this is handled by the camera itself and the lights on the scene, so you don't need to touch this unless you know what you're doing!

environment:FoxEnvironment

If set, this camera will use a custom environment

Defined by FoxObject

parent:FoxObject

If set, will adapt parent transform. Make sure the parent has a higher priority so it updates in order

position:Vector3D

@:value(new Vector3D())rotation:Vector3D = new Vector3D()

@:value(new Vector3D(1, 1, 1))scale:Vector3D = new Vector3D(1, 1, 1)

x:Float

y:Float

z:Float

angleX:Float

angleY:Float

angleZ:Float

@:value(EulerOrder.ZYX)rotationOrder:EulerOrder = EulerOrder.ZYX

This controls the way this object is rotated (via rotation)

The rotation is applied per-axis sequentially, meaning the way one axis rotate can influence the next rotation.

By default, the Z axis rotates first, this makes the object roll.

Then the Y axis is rotated next, this orients the rolled object horizontally, think of it as a swiveling floor fan.

And last, the X axis is rotated, this has the effect of tilting the Y rotation.

This is done in this order so there is no gimbal-lock when converting euler angles from quaternions. However, this order affects camera rotations.

Custom camera controllers should use ZXY order instead so no tilting occurs.

@:value(new Matrix3D())transform:Matrix3D = new Matrix3D()

This is the global transform for this Object, it encodes position, rotation and scale in a 4x4 matrix

@:value(new Vector3D())read onlyglobalPosition:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalRotation:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalScale:Vector3D = new Vector3D()

Defined by FoxBasic

@:value("FoxBasic")name:String = "FoxBasic"

@:value(true)visible:Bool = true

@:value(true)active:Bool = true

@:value(null)scene:FoxScene = null

@:value(false)__destroyed:Bool = false

animation:FoxAnimationPlayer

An animation controller for this basic. Although properties have to be manually linked, this is intended to be a general-purpose animator for this object

Inherited Methods

Defined by FoxFPSCamera

inlinepressed(key:String):Float

Defined by FoxCamera

render(drawGroups:Array<FoxDrawTree>):Void

getScreenPoint(point:Vector3D):Vector3D

Projects a world-space 3D point to Normalized Device Coordinate (NDC, aka Screen-Space Position).

Note: the center is at (0,0) instead of (0.5, 0.5). If you need flixel coordinates, use toFlixelScreenPoint()

Note 2: The values are unclamped! Make sure to clamp them if needed.

toFlixelScreenPoint(point:Vector3D, screenWidth:Float, screenHeight:Float, ?output:FlxPoint):FlxPoint

inlinegetFlixelScreenPoint(position:Vector3D, screenWidth:Float, screenHeight:Float):FlxPoint

Shortcut method, calls getScreenPoint() and then toFlixelScreenPoint()

Also returns a FlxPoint instead

getWorldSpace(point:Vector3D):Vector3D

Re-projects a screen-space point to world space, useful for point and click in 3D with raycast.

loadPassesFromAsset(name:String):Void

privateset_fov(v:Float):Float

privateset_aspect(v:Float):Float

privateset_far(v:Float):Float

privateset_near(v:Float):Float

privateset_orthogonal(v:Bool):Bool

Defined by FoxObject

@:value({ z : 0, y : 0, x : 0 })setPosition(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })setRotation(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })setAngle(x:Float = 0, y:Float = 0, z:Float = 0):Void

Same as setRotation() but for angle degrees.

setAngleFromVector(angles:Vector3D):Void

Sets the object's angle degrees from a Vector3D

getAngle(?output:Vector3D):Vector3D

Gets the object's rotation as degrees, as a Vector3D

Parameters:

output

(Optional) the output vector to store the angles without allocating a new one

Returns:

a Vector3D containing angleX, angleY and angleZ

@:value({ w : 1, z : 0, y : 0, x : 0 })setRotationQuaternion(x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1):Vector3D

Sets the object's rotation from a Quaternion, which is needed for accurate rotation representation when interpolating.

How dows it work? hell if i know

setRotationQuaternionFromVector(quat:Vector3D):Vector3D

@:value({ z : 1, y : 1, x : 1 })setScale(x:Float = 1, y:Float = 1, z:Float = 1):Void

copyComponentsFrom(object:FoxObject):Void

Copies position, rotation and scale from another FoxObject, so the other object's components doesn't affect this one when changing them

privateget_globalPosition():Vector3D

privateget_globalRotation():Vector3D

privateget_globalScale():Vector3D

privateget_x():Float

privateget_y():Float

privateget_z():Float

privateinlineset_x(v:Float):Float

privateinlineset_y(v:Float):Float

privateinlineset_z(v:Float):Float

privateset_angleX(v:Float):Float

privateset_angleY(v:Float):Float

privateset_angleZ(v:Float):Float

privateget_angleX():Float

privateget_angleY():Float

privateget_angleZ():Float

Defined by FoxBasic

physicsUpdate(dt:Float):Void

Called when a physics frame occurs, this is a constant update regardless of framerate for a consistant physics simulation.

draw(camera:FoxCamera):Void

Intended for transforms, actual drawing happens in the camera render pass

pushDrawData(scene:FoxScene):Void

This function gets called when the scene starts building draw groups.

It should call the scene's addToDrawGroups() function for every drawable of this object.

Override this with your custom draw data function.

Note: Internal use only, it is a performance critical operation, keep it fast.

computeBounds(output:BoundingBox):Void

Gets the bounding box of all meshes and models inside groups

In FoxBasic this is just a template, do the actual implementation in your models and groups

Parameters:

output

the Bounding Box where to store the result

testAndCull(camera:FoxCamera):Void

Performs frustum culling by checking the bounding box against a camera frustum

isVisible():Bool

Template function that returns the final visibility for the basic. Frustum culling can affect this.

isActive():Bool

Template function that returns the final activated state for the basic. Frustum culling can affect this.