intermediate
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Group, Vector3, Matrix4, Mesh, DoubleSide } from 'three';
|
||||
import { Group, Vector3, Matrix4, Mesh, Quaternion, BoxGeometry } from 'three';
|
||||
import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js';
|
||||
import { TextObject } from '../TextObject';
|
||||
|
||||
@@ -12,7 +12,7 @@ class MazeObject {
|
||||
const scale = 5;
|
||||
|
||||
context.wallSize = params.wallSize || .65*scale;
|
||||
context.tubeSize = params.tubeSize || .8*scale;
|
||||
context.tubeSize = params.tubeSize || 1.2*scale;
|
||||
context.wallDepth = params.wallDepth || .1*scale;
|
||||
context.fontPath = params.fontPath || '/static/fonts/ZapfChanceryC.otf';
|
||||
|
||||
@@ -61,12 +61,30 @@ class MazeObject {
|
||||
]
|
||||
});
|
||||
|
||||
engine.phy.add(
|
||||
{position: room.localToWorld(new Vector3(context.tubeSize / 2 - cameraNear, 0, offsetZ + cameraNear))},
|
||||
'fixed', false, undefined, 'cuboid',{
|
||||
width:offsetZ*10, height:10, depth:10
|
||||
}
|
||||
)
|
||||
let quat = new Quaternion();
|
||||
room.getWorldQuaternion(quat);
|
||||
|
||||
console.log('adding!!!', room.localToWorld(new Vector3(context.tubeSize / 2, 0.6, offsetZ/2)), quat)
|
||||
|
||||
// const geometry = new BoxGeometry(2, 2, offsetZ);
|
||||
// const cube = new Mesh(geometry, o.tunnel.material)
|
||||
// cube.position.set(context.tubeSize / 2, 0.6, offsetZ/2)
|
||||
// root.add(cube);
|
||||
|
||||
// console.log(offsetZ, room.localToWorld(new Vector3(context.tubeSize / 2, 0.6, offsetZ/2)))
|
||||
|
||||
let left = engine.phy.add(
|
||||
{position: room.localToWorld(new Vector3(context.tubeSize / 2, 0.6, offsetZ/2))},
|
||||
'fixed', false, undefined, 'cuboid',{ width: 0.01, height:1, depth:offsetZ/2 }
|
||||
)
|
||||
left.rigidBody.setRotation(quat, true)
|
||||
|
||||
// let right = engine.phy.add(
|
||||
// {position: room.localToWorld(new Vector3(-context.tubeSize / 2, 0.6, offsetZ/2))},
|
||||
// 'fixed', false, undefined, 'cuboid',{ width: 0.01, height:1, depth:offsetZ/2 }
|
||||
// )
|
||||
// right.rigidBody.setRotation(quat, true)
|
||||
|
||||
|
||||
if (def.type == 'area') {
|
||||
def.area.forEach(ar => {
|
||||
@@ -148,7 +166,7 @@ class MazeObject {
|
||||
mazeMeshes.forEach(mesh=>{
|
||||
//let mesh = new Mesh(mg, o.tunnel.material)
|
||||
root.add(mesh);
|
||||
engine.phy.add(mesh, 'dynamic')
|
||||
//engine.phy.add(mesh, 'fixed')
|
||||
})
|
||||
|
||||
console.log(o.tunnel)
|
||||
|
||||
Reference in New Issue
Block a user