mark!!!
看视频很有意思,在线demo基本加载不出来
我在运行时spline.removeNode后。
public getSampleAtDistance (d: number, out?: CurveSample): CurveSample
{
if (d < 0 || d > this.length)
throw new Error("Distance must be positive and less than curve length. Length = " + this.length + ", given distance was " + d);
if (d === 0) { d = 0.001; } else if (d === this.length) { d = this.length - 0.001; }
let samples = this.samples; let previous = samples[0]; let next = null; for (let i = 0; i < samples.length; i++) { let cp = samples[i]; if (cp.distanceInCurve >= d) { next = cp; break; } previous = cp; } if (next == null) { throw new Error("Can't find curve samples."); } let t = next == previous ? 0 : (d - previous.distanceInCurve) / (next.distanceInCurve - previous.distanceInCurve);
return CurveSample.lerp(previous, next, t, out); }
总是会(next == null),然后就抛出一个错误。
spline tool代码和水那部分都是引用的。直接下载回来是没有的。你要另外下载或者命令行更新一下。
嗯嗯 又搞了下梯子用update module补全了
有没有实例代码呢,我确实还没测试运行时修改的情况
我就是直接移除了所有节点,然后添加了一些新的。
我试过先移除节点,在添加,和添加完了再移除。
只是调用了removeNode,没调用其它函数。
就只是removeNode和addNode
大佬 可以不可以出一个 utils.createMesh自定义的教程
有点麻烦,你可以参考下这两个文件
大佬能帮看看这个CANNON物理引擎问题吗
我去。我要mark一下。
有性能测试 吗?
大佬,能不能搞个集成版本啊,从码云上搞下来的不完整呢!!!!!!!!
你下载对应的 submodule 放进去也可以
大佬能不能看看运行时更新节点的问题呢
在运行时,我这么写,大大多数时候,形状是不会更新的。
我用的是Sower模式
upboxs(spline:Spline, points:Vec3[]) { if( points.length <= spline.nodes.length) { for(let i = 0; i < this.path.length; i+=3) { spline._nodes[i].position.set(points[i]); spline._nodes[i].direction.set(points[i]); } spline._nodes = spline.nodes.slice(0,points.length) } else { let x = spline.nodes.length; for(let i = 0 ; i < spline.nodes.length; i++) { spline._nodes[i].position.set(points[i]); spline._nodes[i].direction.set(points[i]); } for(let i = x; i < points.length; i ++) { let v = points[i]; spline.addNode(v,v); } } }
设置完后调用spline._createCurves();形状就会更新了。
我觉得你这个功能可以加到编辑器上面去