Detect groups from 3d obj file format.Then add collider box
on every mesh with name sufix or prefix Cube.COLLIDER.1.
This is update for matrix-engine obj loader.
See YT video:
https://www.youtube.com/watch?v=_ISsjt0GXww&t=808s
*Project source: *
https://github.com/zlatnaspirala/matrix-engine-starter
Update Details :
[2.1.6] Added map creator from starter project.
[2.1.1] Just added example how to load maps and detect groups vertices.
[2.1.0] Added MapCreator web tools
New export for npm pack `meMapLoader`
Usage:
Automatic load on refresh me app. MapCreator make saves on every new field.
You need just to refresh page.
if (localStorage.getItem('map') != null) {
var t = localStorage.getItem('map');
t = JSON.parse(t)
meMapLoader.load(t, physics);
} else {
meMapLoader.load(map, physics);
}
If you wanna just always load map from disk/file then use:
import {map} from "../maps/map2";
...
meMapLoader.load(map, physics);
To make map goto `public\tools\map-creator.html`
[2.1.4] draObj DRAW
object.instancedDraws.overrideDrawArraysInstance(object);
objObject.instancedDraws = {
numberOfInstance: 10,
array_of_local_offset: [0, 0, 0],
overrideDrawArraysInstance: function (object_) {}
};
[2.1.3] Prevent error [render file]
else if(local.physics.currentBody.shapeOrientations.length > 1) {
// Check
if (local.subObjs) for(var x = 0;x < local.subObjs.length;x++) {
[2.1.2]You can scale mesh general with:
App.scene.armor.mesh.setScale(2);
Or by axis:
App.scene.armor.mesh.setScale({x: 1, y: 2, z: 2});
[2.1.1] testTrimesh added , visual OK , physics need more updated.
Cannonjs collision not work for this type of custom geo object...
world.Add('generatorLightTex', 1, 'floorAngle', tex, {
radius: 1,
custom_type: 'testTrimesh',
custom_geometry: new CANNON.Trimesh(vertices, indices)
});
[2.1.0] Much better physics for cube
Line:
var AXIS = vec3.fromValues(-parseFloat(object.rotation.axisSystem[0].x.toFixed(2)), parseFloat(object.rotation.axisSystem[0].z.toFixed(2)), parseFloat(object.rotation.axisSystem[0].y.toFixed(2)));
[2.0.38] Full custom geometry inject cannonjs shape object for
for CANNON.ConvexPolyhedron.
Example of usage:
world.Add('generatorLightTex', 1, 'outsideBox2', tex, {
radius: 1,
custom_type: 'testConvex',
custom_geometry: createTetra()
});
[2.0.34] New App flag: App.printDevicesInfo: false
[2.0.31] Simplify `SET_STREAM` for ACCESS CAMERA
[2.0.30]
For FirstPersonController added move in left or right by side...
UPDATE IN setCamera func:
// For FirstPersonController
camera.setCamera = function (object) {
if (keyboardPress.getKeyStatus(65) || App.camera.leftEdge == true) {
/* A */
camera.yawRate = App.camera.yawRate;
if (App.camera.leftEdge == true) {
camera.yawRate = App.camera.yawRateOnEdge;
}
} else if (keyboardPress.getKeyStatus(68) || App.camera.rightEdge == true) {
/* D */
camera.yawRate = -App.camera.yawRate;
if (App.camera.rightEdge == true) {
camera.yawRate = -App.camera.yawRateOnEdge;
}
} else if (keyboardPress.getKeyStatus(32)) {
/* Right Key or SPACE */
if (this.virtualJumpActive != true) {
this.virtualJumpActive = true;
}
}
if (keyboardPress.getKeyStatus(37)) {
/* Left Key || App.camera.leftEdge == true*/
camera.moveLeft = true;
camera.speed = App.camera.speedAmp;
} else if (keyboardPress.getKeyStatus(39)) {
/* Right Key || App.camera.rightEdge == true */
camera.moveRight = true;
camera.speed = App.camera.speedAmp;
} else if (keyboardPress.getKeyStatus(38) || keyboardPress.getKeyStatus(87)) {
/* Up Key or W */
camera.speed = App.camera.speedAmp;
} else if (keyboardPress.getKeyStatus(40) || keyboardPress.getKeyStatus(83)) {
/* Down Key or S */
camera.speed = -App.camera.speedAmp;
} else {
// if(camera.preventSpeedZero == false) camera.speed = 0;
}
/* Calculate yaw, pitch and roll(x,y,z) */
if (camera.speed != 0 && camera.moveLeft == false && camera.moveRight == false) {
camera.xPos -= Math.sin(degToRad(camera.yaw)) * camera.speed;
if (camera.fly == true) {
// Fly regime
camera.yPos += Math.sin(degToRad(camera.pitch)) * camera.speed;
} else {
// usually for fpshooter regime
// camera.yPos = this.virtualJumpY;
// camera.yPos = 0;
// leave it zero by default lets dirigent from top
}
camera.zPos -= Math.cos(degToRad(camera.yaw)) * camera.speed;
} else if (camera.moveLeft == true) {
// by side move left
camera.xPos -= Math.sin(degToRad(camera.yaw + 90)) * camera.speed;
camera.zPos -= Math.cos(degToRad(camera.yaw + 90)) * camera.speed;
} else if (camera.moveRight == true) {
// by side move rigth
camera.xPos -= Math.sin(degToRad(camera.yaw - 90)) * camera.speed;
camera.zPos -= Math.cos(degToRad(camera.yaw - 90)) * camera.speed;
}
camera.yaw += camera.yawRate * camera.yawAmp;
camera.pitch += camera.pitchRate * camera.pitchAmp;
mat4.rotate(object.mvMatrix, object.mvMatrix, degToRad(-camera.pitch), [1, 0, 0]);
mat4.rotate(object.mvMatrix, object.mvMatrix, degToRad(-camera.yaw), [0, 1, 0]);
mat4.translate(object.mvMatrix, object.mvMatrix, [-camera.xPos, -camera.yPos, -camera.zPos]);
camera.yawRate = 0;
camera.pitchRate = 0;
// update
camera.moveLeft = false;
camera.moveRight = false;
if (camera.preventSpeedZero == false) camera.speed = 0;
};
[2.0.27] Added for CustomGeometry object entity:
customObject.net = {
enabled: false
};
[2.0.26] FIX CHECK NET ACTIVE FLAG FOR SCALE PROCEDURE
[2.0.25] FIX FOR MOBILE RENDER MATERIAL/ TEXTURE - Bug with white surface
// world.disableUnusedAttr(world.GL.gl, localLooper);
world.disableUnusedAttr(world.GL.gl, 4);
[2.0.24] New prop in App.camera (manifest)
`App.camera.yawRateOnEdge`
camera.setCamera = function(object) {
if(keyboardPress.getKeyStatus(37) || keyboardPress.getKeyStatus(65) || App.camera.leftEdge == true) {
/* Left Key or A */
camera.yawRate = App.camera.yawRate;
if(App.camera.leftEdge == true) {
camera.yawRate = App.camera.yawRateOnEdge;
}
} else if(keyboardPress.getKeyStatus(39) || keyboardPress.getKeyStatus(68) || App.camera.rightEdge == true) {
/* Right Key or D */
camera.yawRate = -App.camera.yawRate;
if(App.camera.rightEdge == true) {
camera.yawRate = -App.camera.yawRateOnEdge;
}
}
[2.0.23] New line in EVENTS About WASD FPController
Reason - adaptation for mobile FPController
` if (camera.preventSpeedZero == false) camera.speed = 0;`
js
/* Up Key or W */
if (keyboardPress.getKeyStatus(38) || keyboardPress.getKeyStatus(87)) {
camera.speed = App.camera.speedAmp;
} else if (keyboardPress.getKeyStatus(40) || keyboardPress.getKeyStatus(83)) {
/* Down Key or S */
camera.speed = -App.camera.speedAmp;
} else {
if (camera.preventSpeedZero == false) camera.speed = 0;
}
[2.0.17 version Vampir]
Objective
- Deplace old networking and put kurento/OV web client code.
- Mobile device ready
- GUI Editor (win) basic version ready
[2.0.17] New event from core net updater.
`dispatchEvent('network-data', {detail: e.data})`
For better customisation.
js
update(e) {
e.data = JSON.parse(e.data);
dispatchEvent('network-data', {detail: e.data})
// console.log('INFO UPDATE', e);
if(e.data.netPos) {
if(App.scene[e.data.netObjId]) {
if(e.data.netPos.x) App.scene[e.data.netObjId].position.SetX(e.data.netPos.x, 'noemit');
if(e.data.netPos.y) App.scene[e.data.netObjId].position.SetY(e.data.netPos.y, 'noemit');
if(e.data.netPos.z) App.scene[e.data.netObjId].position.SetZ(e.data.netPos.z, 'noemit');
}
} else if(e.data.netRot) {
[2.0.16] Added to the Base Class Position `xNetOffset yNetOffset zNetOffset`
Nice for calibration.
[2.0.14] For obj sequency animation `objObject.scaleAll`
**New updates for Matrix-Roulette & hang3d FPS Basic template:**
https://maximumroulette.com/apps/matrix-engine-starter/projects/matrix-slot/
https://maximumroulette.com/apps/matrix-engine-starter/projects/hang3d/
New updates for Matrix-Roulette & hang3d FPS Basic template:
https://maximumroulette.com/apps/matrix-engine-starter/projects/matrix-slot/
https://maximumroulette.com/apps/matrix-engine-starter/projects/hang3d/
Thanks for any support ,
Welcome for collaboration.
Top comments (0)