Skip to content

Instantly share code, notes, and snippets.

Avatar

Limes2018 flushpot1125

View GitHub Profile
View review-ci-pdf.yml
name: Build Re:VIEW to make distribution file
# The workflow is triggered on pushes to the repository.
on: [push]
jobs:
build:
name:
runs-on: ubuntu-latest
steps:
# uses v2 Stable version
View review-ci.yml
image: vvakame/review:5.4
build-pdf:
script: # build-in-docker.sh の終盤と同じもの
- ./setup.sh
- npm run pdf
artifacts:
paths:
- articles/ReVIEW-Template.pdf
tags:
View photon_sword_effect.js
var photonSwordParticleJson ={"name":"CPU particle system","id":"default system","capacity":10000,"disposeOnStop":false,"manualEmitCount":-1,"emitter":[0,0,0],"particleEmitterType":{"type":"PointParticleEmitter","direction1":[0,1,0],"direction2":[0,1,0]},"texture":{"tags":null,"url":"https://assets.babylonjs.com/textures/flare.png","uOffset":0,"vOffset":0,"uScale":1,"vScale":1,"uAng":0,"vAng":0,"wAng":0,"uRotationCenter":0.5,"vRotationCenter":0.5,"wRotationCenter":0.5,"homogeneousRotationInUVTransform":false,"isBlocking":true,"name":"https://assets.babylonjs.com/textures/flare.png","hasAlpha":false,"getAlphaFromRGB":false,"level":1,"coordinatesIndex":0,"coordinatesMode":0,"wrapU":1,"wrapV":1,"wrapR":1,"anisotropicFilteringLevel":4,"isCube":false,"is3D":false,"is2DArray":false,"gammaSpace":true,"invertZ":false,"lodLevelInAlpha":false,"lodGenerationOffset":0,"lodGenerationScale":0,"linearSpecularLOD":false,"isRenderTarget":false,"animations":[],"invertY":true,"samplingMode":3,"_useSRGBBuffer":false},"isLocal"
View dispose.js
scene.registerBeforeRender(function () {
scene.meshes.forEach(function (m) {
if (m.name=="ballInstance" && (m.position.z <-100)||(m.position.z > 100)) {
m.dispose();
}
})
});
View shooting.js
function shoot () {
const ballInstance = bullet.createInstance("ballInstance");
ballInstance.position.copyFrom(reticle.getAbsolutePosition());
ballInstance.physicsImpostor = new BABYLON.PhysicsImpostor(ballInstance, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1, friction: 0.2, restitution: 0.2 });
ballInstance.applyImpulse(ray.direction.scale(impulseMagnitude), bullet.getAbsolutePosition().add(contactLocalRefPoint));
}
View ray.js
var ray;
function castRay(){
ray = scene.activeCamera.getForwardRay();
}
engine.runRenderLoop(function () {
castRay();
});
View reticle.js
/*Sphere reticle*/
var reticle = BABYLON.Mesh.CreateSphere("reticle", 10, .03, scene);
var retmat= new BABYLON.StandardMaterial("reticalmaterial", scene);
retmat.emissiveColor = BABYLON.Color3.Red();
retmat.specularColor = BABYLON.Color3.Black();
reticle.material = retmat;
reticle.isPickable = false;
reticle.position.z = 2;
reticle.parent = camera;
View enablePhysics.js
scene.enablePhysics();
var physicsEngine = scene.getPhysicsEngine();
gravity = new BABYLON.Vector3(0,0,0);
physicsEngine.setGravity(gravity);
View createHTMLLink.js
View keyboard_input_reduce_HPbar.js
scene.onKeyboardObservable.add((kbInfo) => {
switch (kbInfo.type) {
case BABYLON.KeyboardEventTypes.KEYDOWN:
switch (kbInfo.event.key) {
case "a":
console.log("hit");
beta = beta -10;
UI.showProgressBar(beta);
break