Archive
Last modified by Victor Zhang on 16:38, 07/04/2020
Blog - posts for May 2020
May 21, 2020
Development log - GDice - Number
- Developed Nixie Tube's appearance as spritesheet
- Test use here: Nixie Spritesheet
- Has all source files
- Uploaded to: https://opengameart.org/content/nixie-digits-spritesheet as CC-BY-4.0
- Might not be used in final project as the numbers are too small
- Maybe it's just better to photoshoot the tube running using Arduino
May 18, 2020
Raycast on Phaser Camera3D Plugin
- The problem is actually discovered by a student when trying to implement a forward running game (They need to click the enemy)
- The camera3d class provides a ray function: https://photonstorm.github.io/phaser3-docs/Phaser.Cameras.Sprite3D.PerspectiveCamera.html#getPickRay__anchor
- In that way, calculating the x,y on the target plane and then do some hit-test manually would do the job
- Used example: http://labs.phaser.io/edit.html?src=src\camera\3D%20camera\floor.js
- Modify line 33 to : var balls = camera.createRect({ x: 8, y: 1, z: 8 }, 32, 'ball');
- Add following block to create():
balls.forEach( function(ball){
ball.setData('tag', 'ball'+ball.x+':'+ball.y+':'+ball.z);
} )
this.input.on('pointerdown', function (pointer) {
ray = camera.getPickRay(pointer.x, pointer.y);
balls.forEach( function(ball){
// r is hardcoded here
let r = 4;
// calculate x y @ z of the object
let tx, ty;
let tz = ball.z;
tx = ray.origin.x + ray.direction.x * (tz - ray.origin.z ) / ray.direction.z;
ty = ray.origin.y + ray.direction.y * (ray.origin.z - tz) / ray.direction.z;
let tl = Math.sqrt( Math.pow(tx - ball.x, 2) + Math.pow(ty - ball.y, 2) );
if( tl < r ){
console.log(ball.getData('tag')+' isHit');
ball.gameObject.alpha = 0;
}
} );
}, this); - Explanation:
- the radius is hard coded here (5)
- more complex hit testing will need to be implemented for complex shapes
- manually enumerated through all object, inefficient (may need to implement some obvious exclusion for optimization)
- Extra problem
- Why is y axis reversed here?
- To study:
- Math of https://codepen.io/samme/pen/PBMaLJ ray blocking ,will be useful for next project
May 6, 2020
Imaging Device and Webcam
- As the recent need for remote learning, trying to setup stream hardware
- ITS has Doc Cam hardware however the driver they provide here: https://www.elmoeurope.com/index.php/en/download-service/software installs the device as "Imaging devices" which is somehow different from "Cameras" ( from device manager)
- TWAIN is also used by scanner so understand why it does make sense for Chat apps not supporting it
- But why do real-time doc cam register as TWAIN instead of Cameras
- It doesn't provide better quality
- Speculations:
- YUV format?
- FPS?
- Irregular resolution?
- PS Eye driver written by this company https://codelaboratories.com/products/eye/driver/
- Archive (link : https://archive.org/download/CLEyeDriver5.3.0.0341Emuline/CL-Eye-Driver-5.3.0.0341-Emuline.exe)[ ]
- Also registers as "Imaging devices" thus meaning can't be used by most of the windows apps
- Making a TWAIN to Camera bridge
- Does it worth the effort?
- As newer devices(even doc cams) supports UVC driver
- If as a hobby project, what's the effort
- Device driver
- Bridging service