Hey,
I am toying with the LaserGun from the tutorial and trying to replace the example assets with custom models. For some reason the mesh I am importing for the LaserShot replacement is not scaling. All I am trying to do is replace the cylinder with a model that has an emission material on it.
I have tested using a primitive cylinder from the shapes menu and it scales fine, albeit on the wrong axis, but easily fixable. The gravity, physics and collisions are set correctly as the example LaserShot.
The code makes sense and I've ran various debugs to make sure things are calculating correctly:
var thisEntityScaleY = this.entity.scale.get().y;
console.log("thisEntityScaleY = " + thisEntityScaleY)
var laserBeamScale = this.props.laserBeam.scale.get();
laserBeamScale.x = this.props.laserBeamWidth;
laserBeamScale.y = laserLength / thisEntityScaleY;
console.log("laserBeamScale.y = " + laserBeamScale.y)
laserBeamScale.z = this.props.laserBeamWidth;
this.props.laserBeam.scale.set(laserBeamScale);
this.props.laserBeam.color.set(Color.red);
this.props.laserBeam.moveRelativeTo(this.entity, new Vec3(0, laserLength / (2 * thisEntityScaleY), 0));
I had this working quite early on but as I've been changing things I can't for the life of me work out what I am doing wrong.
To put it simply I am trying to create a laser beam with emission on a custom weapon.
Any help is greatly appreciate.