refactor: better attraction
This commit is contained in:
parent
a147b3f7d2
commit
c14f167456
|
@ -72,8 +72,8 @@ export class Magnetic extends decorate(Trait) {
|
|||
}
|
||||
const difference = Vector.sub(this.entity.position, entity.position);
|
||||
const unit = Vector.normalize(difference);
|
||||
const rdiff = 1 - (distance / attraction);
|
||||
const magnitude = 50 * rdiff;
|
||||
const rdiff = Math.max(0.4, 1 - (distance / attraction));
|
||||
const magnitude = 100 * rdiff;
|
||||
entity.applyMovement(Vector.scale(unit, magnitude));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ export function createEntityForConnection(socket) {
|
|||
params: {
|
||||
isAttractor: true,
|
||||
},
|
||||
state: {
|
||||
attraction: 20,
|
||||
}
|
||||
},
|
||||
mobile: {
|
||||
state: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user