1234567891011121314151617181920212223242526272829303132333435 |
- import RapierBody from '@RE/RogueEngine/rogue-rapier/Components/RapierBody.re';
- import * as RE from 'rogue-engine';
- export default class RapierColliderTweaks extends RE.Component {
- body:RapierBody
- @RE.props.num() friction: number = 0
- awake() {
- this.object3d.traverse(obj => {
- const components = RE.getObjectComponents(obj);
- components.forEach(comp => {
- if (comp instanceof RapierBody) {
- this.body = comp
- }
- });
- });
- const numColliders = this.body.body.numColliders()
- for(let i = 0; i < numColliders; i ++) {
- this.body.body.collider(i).setFriction(this.friction)
- }
- }
- start() {
- }
- update() {
- }
- }
- RE.registerComponent(RapierColliderTweaks);
-
|