06-06-2025 05:48 AM
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:
Solved! Go to Solution.
06-06-2025 11:56 AM
Seems to be working now, so what I believe was the issue came down to using "replace" and "update" of the model after changing pivot points. It is a nested object. I am not sure if that is a known bug, but happy to log it if anyone wants to point me in the right direction.
There was also a large offset from
this.props.laserBeam.moveRelativeTo(this.entity, new Vec3(0, laserLength / (2 * thisEntityScaleY), 0))
I settled with the Y value of Vec3 set to thisEntityScaleY and it looks fine. Also worked well just setting it to 1.
Phew, now I can move on 😅 Thanks for the response @SeeingBlue 😎
06-06-2025 07:12 AM - edited 06-06-2025 07:12 AM
I suspect the scale of the cylinder you import is not the same scale of the previous cylinder. When you have you cylinder in blender, make sure the dimensions say 1,1,1 then apply the scale. You can fix rotation this way too.
06-06-2025 08:06 AM
Yes it's something to do with the model. The scale is 1,1,1 and all transforms applied in Blender. I'm trying different pivots atm... It's doing something, just not what I want. I think previously the scaling was happening out of sight from the camera.
06-06-2025 11:56 AM
Seems to be working now, so what I believe was the issue came down to using "replace" and "update" of the model after changing pivot points. It is a nested object. I am not sure if that is a known bug, but happy to log it if anyone wants to point me in the right direction.
There was also a large offset from
this.props.laserBeam.moveRelativeTo(this.entity, new Vec3(0, laserLength / (2 * thisEntityScaleY), 0))
I settled with the Y value of Vec3 set to thisEntityScaleY and it looks fine. Also worked well just setting it to 1.
Phew, now I can move on 😅 Thanks for the response @SeeingBlue 😎