init dump
This commit is contained in:
33
Sources/Test/Objects/JolkCube.swift
Normal file
33
Sources/Test/Objects/JolkCube.swift
Normal file
@ -0,0 +1,33 @@
|
||||
import Foundation
|
||||
import simd
|
||||
import JolkEngine
|
||||
|
||||
|
||||
class JolkCube: Actor
|
||||
{
|
||||
private var _pos: Vec3f
|
||||
private var theta: Float = 0.0
|
||||
|
||||
init(position: Vec3f)
|
||||
{
|
||||
_pos = position
|
||||
}
|
||||
|
||||
var position: Vec3f { _pos }
|
||||
|
||||
func update(deltaTime: Float, world: Collision)
|
||||
{
|
||||
theta += 15 * deltaTime
|
||||
_pos.y = 1 + sin(theta * 0.25) * 0.25
|
||||
}
|
||||
|
||||
var transform: Mat4f
|
||||
{
|
||||
.translate(_pos) *
|
||||
.rotate(x: theta * 0.25) *
|
||||
.rotate(y: Float.rad(fromDeg: theta)) *
|
||||
// .rotate(axis: .X, angle: theta * 0.25) *
|
||||
// .rotate(axis: .Y, angle: Float.rad(fromDeg: theta)) *
|
||||
.scale(scalar: 0.25)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user