利用Threejs封装电流效果, 在initObject方法中添加一个路径就可以
//样条线,根据规划的路径显示电流 云
const curve_catmullRom3 = new THREE.CatmullRomCurve3( [
new THREE.Vector3( 500, 500, 0 ),
new THREE.Vector3(900, 600, 0 ),
new THREE.Vector3(450, 200, 0 ),
new THREE.Vector3(1100, 500, 0 ),
new THREE.Vector3(1150, 450, 0 )
] );
//根据样条线获得详细的点,用于处理拐角不平滑的问题
let electricLine_sub3 = curve_catmullRom3.getPoints( 50 );
electricLinePointArray.push({curIndex:0,pointList:electricLine_sub3});
如果需要修改电流的震动幅度修改electricLine.rayParams的参数
electricLine.rayParams = {
sourceOffset: new THREE.Vector3(), //电起点
destOffset: new THREE.Vector3(), //电重点
radius0: 6, //起点线的粗细0.1 -10 起始最好保持一致
radius1: 6, //结束线的粗细0.1 -