大家好,我目前正在尝试实现激光武器的效果,但在 AGM 手法下面临一些课题,希望能得到各位的建议。
目前的尝试方法
PGM 侧的实现
用透明对象增加碰撞框 X 轴比例作为命中判定。
与敌人或墙壁碰撞时获取接触比例,并将该值反映到对象的 X 比例缩放中。
AGM 侧的实现
使用 RayCast2D 节点进行碰撞判定,通过 Line2D 节点绘制可视化的光束。
需要通过代码实现节点间的联动,但目前未能成功实现。
面临的问题
AGM 侧:无法理解 RayCast2D 与 Line2D 的联动代码,光束绘制位置无法正确呈现。
提问内容
能否提供 AGM 中 RayCast2D 与 Line2D 联动的代码示例?
恳请各位给予建议!
//
皆さん、こんにちは。レーザー武器のエフェクト実装中に AGM 手法の課題に直面しています。ご助言をいただければ幸いです。
現在の取り組み方法
PGM 側の実装
- 透明オブジェクトで当たり判定の X 軸サイズを拡大
- 敵 / 壁との衝突時に接触割合を取得し、オブジェクトの X 軸スケールに反映
AGM 側の実装
- RayCast2D で衝突判定を行い、Line2D で視覚的な光線を描画
- ノード間のコード連携が必要だが、うまく実装できていない
直面している問題
AGM 側:RayCast2D と Line2D の連携コードが理解できず、光線の描画位置が正しく表示されない
質問内容
AGM で RayCast2D と Line2D を連携させるコード例を教えていただけますか?
宜しくお願いいたします。
//
Hello everyone, I’m facing issues with AGM approach while implementing laser weapon effects. Your advice is highly appreciated.
Current Attempts
PGM Implementation
- Using transparent objects to expand collision box X-axis size for hit detection
- Acquiring contact ratio on enemy/wall collision and reflecting it to object’s X-axis scale
AGM Implementation
- Using RayCast2D for collision detection and Line2D for visual beam rendering
- Struggling to implement code linkage between nodes
Issue Faced
AGM side: Can’t understand how to link RayCast2D with Line2D code, beam rendering position is incorrect
Question
Could you provide a code example for linking RayCast2D and Line2D in AGM?
Thank you in advance for your help!