Skip to content

Commit

Permalink
Add apply force
Browse files Browse the repository at this point in the history
  • Loading branch information
STREGA committed Dec 1, 2023
1 parent d9042c7 commit 613286e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public final class Physics3DComponent: Component {

public var xzAcceleration: Float? = nil
public var xzDeceleration: Float? = nil

public func applyForce(_ force: Float, inDirection direction: Direction3) {
self.velocity += direction.normalized * force
}

func update(_ deltaTime: Float) {
if let xzAcceleration = xzAcceleration, velocityXZMagnitude >= xzSpeed {
Expand Down

0 comments on commit 613286e

Please sign in to comment.