保持对代码的理解,不要完全依赖AI Coding——由一段Babylon.js开发出现的bug引发的感慨
子曰AI Coding并不知道自己在干什么。子曰如果一段代码的bug找不到不要整晚死磕好好睡一觉很可能第二天早上就找到了。子还曰保持清醒比无脑努力重要136.25倍。子路重要程度需要精确到小数点后两位吗子曰需要使用cursor开发一个基于Babylonjs引擎的内容cursor通过opus4.8帮我写了如下代码注意的两段代码中关于attach的部分import { Observable, TransformNode, type Behavior } from babylonjs/core; export default abstract class LerpBehavior implements BehaviorTransformNode { public get name(): string { return LerpBehavior; } public static readonly behaviorName: string LerpBehavior; private _uuid: string ; public get uuid(): string { return this._uuid; } protected _setUuid(uuid: string): void { this._uuid uuid; } protected _target: TransformNode | null null; public get target(): TransformNode | null { return this._target; } public readonly onSetProcessObservable new Observablenumber(); public readonly onDetachObservable new Observablevoid(); init() { } protected _isInitialized: boolean false; protected _attached: boolean false; attach(target: TransformNode) { if (this._attached) return; this._attached true; this._target target; } detach() { this.onDetachObservable.notifyObservers(); this.onDetachObservable.clear(); this._target null; this._attached false; this._isInitialized false; } public dispose(): void { this._target?.dispose(); } public setProcess(process: number): void { if (!this._isInitialized this._target) { this._initialize(); } this._applyProcess(process); } protected abstract _applyProcess(process: number): void; protected abstract _initialize(): void; }import LerpBehavior from ./LerpBehavior; import { Vector3, TransformNode, Axis, Space, Scalar } from babylonjs/core; import { DTO_LerpPosition } from ../../../../../Shared/TScripts/DTO/DTO_RuntimeSystem; export default class LerpPosition extends LerpBehavior{ public get name():string{return LerpPosition;} public static readonly behaviorName LerpPosition; public static createFromJson(trNode: TransformNode, jsonBehav: string): LerpPosition | undefined{ try { if(trNode){ const data: DTO_LerpPosition JSON.parse(jsonBehav); if (!data) return undefined; const s data.start; const e data.end; const offsetStart new Vector3(s.x, s.y, s.z); const offsetEnd new Vector3(e.x, e.y, e.z); const behavior new LerpPosition(offsetStart, offsetEnd); behavior._setUuid(data.uuid); trNode.addBehavior(behavior, true); behavior.setProcess(data.process || 0); return behavior; } return undefined; } catch (error) { console.error(Failed to create LerpPosition:, error); return undefined; } } private _offsetStart:Vector3; private _offsetEnd:Vector3; private _posStart: Vector3 | null null; private _posEnd: Vector3 | null null; constructor(offsetStart:Vector3, offsetEnd:Vector3){ super(); this._offsetStart offsetStart; this._offsetEnd offsetEnd; } public override attach(target: TransformNode): void { if (this._attached) return; this._attached true; super.attach(target); } /** * 初始化起始和结束位置 * 使用局部空间的translate来计算相对于当前位置的偏移 */ protected override _initialize(): void { if (!this._target || this._isInitialized) return; const currentPosition this._target.position.clone(); this._target.translate(Axis.X, this._offsetStart.x, Space.LOCAL); this._target.translate(Axis.Y, this._offsetStart.y, Space.LOCAL); this._target.translate(Axis.Z, this._offsetStart.z, Space.LOCAL); this._posStart this._target.position.clone(); this._target.position currentPosition; this._target.translate(Axis.X, this._offsetEnd.x, Space.LOCAL); this._target.translate(Axis.Y, this._offsetEnd.y, Space.LOCAL); this._target.translate(Axis.Z, this._offsetEnd.z, Space.LOCAL); this._posEnd this._target.position.clone(); this._target.position currentPosition; this._isInitialized true; } protected override _applyProcess(process: number): void { if (!this._target) { return; } if (this._posStart this._posEnd) { const p Scalar.Clamp(process, 0, 1); this._target.position Vector3.Lerp(this._posStart, this._posEnd, p); this.onSetProcessObservable.notifyObservers(process); } } }注意这中写法会导致子类中的this._target target;这行代码永远得不到执行所以this._target 一直是null 让opus4.8在debug模型调试了一晚上都找不到问题回家睡觉第二天早上一眼就看到了只要把LerpPosition里面的public override attach(target: TransformNode): void { if (this._attached) return; this._attached true; super.attach(target); }写成public override attach(target: TransformNode): void { if (this._attached) return; super.attach(target); this._attached true; }就好了。当然这种 override 代码本来就没个P用我不明白cursor写他干嘛因为这几行狗P根本就是直接删除了也行子最后曰有了AI Coding也不要当甩手掌柜的。

相关新闻

10 个使用 Spring Boot 4 的开发技巧,太惊艳了!

10 个使用 Spring Boot 4 的开发技巧,太惊艳了!

大家好,我是Java1234_小锋老师。Spring Boot 4 在 2025 年底正式发布,底层换成了 Spring Framework 7,很多以前要「自己造轮子」的事情,现在框架直接帮你做好了。这篇文章挑了 10 个我觉得最实用、最容易上手的技巧,每…

2026/6/29 23:32:56阅读更多 →
2026 AI 标书工具综合排名与技术评测:5 款主流产品分梯队解析

2026 AI 标书工具综合排名与技术评测:5 款主流产品分梯队解析

前言随着招投标领域智能化政策落地加速,AI 标书工具已从尝鲜属性转向生产力工具属性。但当前市场产品技术路线分化显著,从通用大模型套壳、模板化填充到垂直全流程方案,能力差距悬殊,大量营销噱头也让企业选型容易陷入认知误区。为…

2026/6/29 23:32:56阅读更多 →
跨平台获取macOS系统镜像:告别苹果硬件的限制

跨平台获取macOS系统镜像:告别苹果硬件的限制

跨平台获取macOS系统镜像:告别苹果硬件的限制 【免费下载链接】gibMacOS Py2/py3 script that can download macOS components direct from Apple 项目地址: https://gitcode.com/gh_mirrors/gi/gibMacOS 你是否曾经需要在Windows或Linux电脑上获取macOS系统…

2026/6/29 23:32:56阅读更多 →
LeetCode 复杂度论证:主定理的推导与算法分析实战

LeetCode 复杂度论证:主定理的推导与算法分析实战

LeetCode 复杂度论证:主定理的推导与算法分析实战 一、复杂度分析不是猜的——从"感觉是 O(n log n)"说起 刷题时经常看到这样的题解:"外层循环 log n 次,内层循环 n 次,所以总复杂度 O(n log n)"。这个结论碰…

2026/6/30 0:53:05阅读更多 →
轻量级语义分割新星LinkNet:如何在移动端实现速度与精度的平衡

轻量级语义分割新星LinkNet:如何在移动端实现速度与精度的平衡

1. LinkNet为何成为移动端语义分割的首选? 第一次接触LinkNet是在一个自动驾驶项目里,当时我们需要在车载设备上实时识别道路场景。试过DeepLabv3和PSPNet这些主流模型后,发现它们就像背着沉重书包的马拉松选手——精度虽高,但根本…

2026/6/30 0:53:05阅读更多 →
免费开源镜像烧录工具Balena Etcher终极指南:安全快速制作系统启动盘

免费开源镜像烧录工具Balena Etcher终极指南:安全快速制作系统启动盘

免费开源镜像烧录工具Balena Etcher终极指南:安全快速制作系统启动盘 【免费下载链接】etcher Flash OS images to SD cards & USB drives, safely and easily. 项目地址: https://gitcode.com/GitHub_Trending/et/etcher 在嵌入式开发、树莓派项目或系统…

2026/6/30 0:53:05阅读更多 →
即插即用 | 重塑跨维度交互,GAM注意力机制在ResNet上的实战优化(附完整代码)

即插即用 | 重塑跨维度交互,GAM注意力机制在ResNet上的实战优化(附完整代码)

1. 为什么需要GAM注意力机制? 在计算机视觉领域,注意力机制就像给神经网络装上了"智能探照灯"。想象一下你在夜晚用手电筒找东西,传统方法可能只会均匀地照亮整个房间,而注意力机制能自动把光束聚焦到最重要的区域。但现…

2026/6/30 0:53:05阅读更多 →
HOG+SVM:从特征提取到行人检测的经典实践

HOG+SVM:从特征提取到行人检测的经典实践

1. HOGSVM行人检测技术全景解读 第一次接触HOG特征是在2013年做智能监控项目时,当时需要检测画面中的行人。深度学习还没现在这么火,HOGSVM就是最靠谱的方案。这么多年过去了,这个经典组合依然在很多嵌入式设备上跑得飞起,今天就带…

2026/6/30 0:53:05阅读更多 →
从矩阵运算到密码实践:深入理解Hill密码的加解密机制

从矩阵运算到密码实践:深入理解Hill密码的加解密机制

1. Hill密码的前世今生 第一次听说Hill密码是在大学密码学课上,教授用粉笔在黑板上画了个33矩阵时,我完全没意识到这串数字会成为我后来项目中的关键工具。Hill密码由数学家Lester S. Hill在1929年提出,属于多表替换密码的经典代表。和凯撒密…

2026/6/30 0:48:05阅读更多 →
AI Coding 六个月真实ROI账本:产品经理的血泪教训,研发的冷静忠告

AI Coding 六个月真实ROI账本:产品经理的血泪教训,研发的冷静忠告

6个月前的2025年12月,Boris Cherny 公开宣布自己卸载了 IDE。一时间,Vibe Coding 成了全行业最热的话题。6个月后,当我们回过头来拉一份真实账本,发现事情远没有"一句话生成一个App"那么浪漫。本文从产品经理和研发两个…

2026/6/29 3:27:55阅读更多 →
审计来了,数据权限全开——审计走了,怎么确保权限全部关掉?

审计来了,数据权限全开——审计走了,怎么确保权限全部关掉?

引言:审计结束三个月了,审计员的权限还没关某城商行每年按照监管要求开展至少一次数据安全审计。审计期间,内审部门需要抽样检查各类业务数据——交易流水、客户信息、员工操作日志、权限配置记录。这些数据分布在不同系统中,审计…

2026/6/29 2:19:08阅读更多 →
为什么你需要Destiny 2 Solo Enabler:技术原理与实战指南

为什么你需要Destiny 2 Solo Enabler:技术原理与实战指南

为什么你需要Destiny 2 Solo Enabler:技术原理与实战指南 【免费下载链接】Destiny-2-Solo-Enabler Repo containing the C# and XAML code for the D2SE program. Included is also the dependency for the program, and image asset. 项目地址: https://gitcode…

2026/6/30 0:02:58阅读更多 →
第六章:PowerPoint 2010 核心功能与实战应用 —— 从入门到精通

第六章:PowerPoint 2010 核心功能与实战应用 —— 从入门到精通

1. PowerPoint 2010基础操作全攻略 刚接触PowerPoint 2010时,很多人会被它复杂的界面吓到。其实只要掌握几个核心区域,就能快速上手。我最开始用PPT时,经常找不到功能按钮在哪,后来发现主要操作都集中在顶部功能区。 工作窗口主要…

2026/6/30 0:02:58阅读更多 →
XGBoost超参数实战:从理论到调优策略

XGBoost超参数实战:从理论到调优策略

1. XGBoost超参数基础认知 第一次接触XGBoost时,我被它那密密麻麻的参数列表吓到了。这感觉就像面对一架波音747的驾驶舱——每个按钮都可能有神奇的效果,但按错了就可能坠机。经过多年实战,我发现其实掌握十几个核心参数就能解决90%的问题。…

2026/6/30 0:02:59阅读更多 →