fix teleporter coordinates
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Group, CylinderGeometry, Mesh, MeshStandardMaterial } from 'three';
|
||||
import { Group, CylinderGeometry, Mesh, MeshStandardMaterial, Vector3 } from 'three';
|
||||
import { EventManager } from '@/lib/EventManager';
|
||||
//import { TextObject } from '../TextObject/TextObject';
|
||||
|
||||
@@ -16,15 +16,19 @@ class Teleporter extends EventManager {
|
||||
s1.isIndividual = true;
|
||||
s1.name = 'T1';
|
||||
engine.clickable.add(s1, ()=>{
|
||||
this.dispatchEvent({type:'interaction', value: 'T1'});
|
||||
engine.hero?.teleport(s2.position)
|
||||
this.dispatchEvent({type:'interaction', value: s1.name});
|
||||
let v = new Vector3().copy(s2.position);
|
||||
v.applyMatrix4(this.object.matrix);
|
||||
engine.hero?.teleport(v)
|
||||
});
|
||||
const s2 = s1.clone();
|
||||
s2.isIndividual = true;
|
||||
s2.name = 'T2';
|
||||
engine.clickable.add(s2, ()=>{
|
||||
this.dispatchEvent({type:'interaction', value: 'T2'})
|
||||
engine.hero?.teleport(s1.position)
|
||||
this.dispatchEvent({type:'interaction', value: s2.name})
|
||||
let v = new Vector3().copy(s1.position);
|
||||
v.applyMatrix4(this.object.matrix);
|
||||
engine.hero?.teleport(v)
|
||||
});
|
||||
s1.position.x = -1;
|
||||
s2.position.x = 1;
|
||||
|
||||
Reference in New Issue
Block a user