Damping2DPlugin

View source

ExtendsPlugin

Adds scalar linear and angular damping to an App.

Register this plugin to provide Linear2DDamping and Angular2DDamping resources and apply their values to matching 2D motion components. It depends on CorePlugin, ReflectPlugin, and Movable2DPlugin.

Examples

import { App } from '@wimaengine/app'
import { CorePlugin } from '@wimaengine/core'
import { Damping2DPlugin } from '@wimaengine/damping'
import { MathPlugin } from '@wimaengine/math'
import { Movable2DPlugin } from '@wimaengine/movable'
import { ReflectPlugin } from '@wimaengine/reflect'

new App()
  .registerPlugin(new ReflectPlugin())
  .registerPlugin(new CorePlugin())
  .registerPlugin(new MathPlugin())
  .registerPlugin(new Movable2DPlugin())
  .registerPlugin(new Damping2DPlugin())
  .run()

Constructor


constructor()

Methods


register(app: App): void

View source

Adds the 2D damping resources to an App and enables damping for matching 2D motion components.

The installed Linear2DDamping and Angular2DDamping resources start with a value of 0.01. Their values are applied to matching 2D linear and angular motion as the app updates.

Parameters

NameDescriptionDefault
app

App to configure.

—