CeeBot:让机器人倾斜

发布于 2024-09-30 17:15:43 字数 145 浏览 3 评论 0原文

使用CeeBot,我还没有找到获取机器人倾斜角度的方法。

例如,如果机器人要向敌人射击,它就必须改变加农炮的角度来瞄准敌人。

但如果机器人不是在平地上,而是在陡峭的地面上,则炮筒的角度就必须考虑陡峭的角度。

可以知道这个角度吗?

Using CeeBot, I haven't found a way to get the tilt angle of a robot.

For example, if the robot have to shoot at an enemy, it has to change the angle of the canon to aim at the enemy.

But if the robot is not on a flat ground, but on a steep, the angle of the canon will have to take into account the angle of the steep.

Is it possible to know this angle ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城空念 2024-10-07 17:15:43

您正在寻找机器人的“俯仰”值。

例如,这个相对简单的代码段找到最近的 TargetBot,然后使用俯仰值加上一些基本三角函数将正确的值输入到 Target() 中。

//our variables
object KillMe;
float range;
float ZDif;
float absoluteElevation;
float correctedElevation;


//calculate the angle we need to adjust our cannon
range = distance(this.position, KillMe.position);
absoluteElevation = atan((KillMe.position.z - position.z)/distance(this.position,KillMe.position));
correctedElevation = absoluteElevation - pitch;

aim(correctedElevation);
fire(0.1);

显然,它没有考虑特定机器人武器的最小/最大高度您正在使用的,或者它的最小-最大范围。

You're looking for the "pitch" value of your robot.

For example, this relatively simple code segment finds the nearest TargetBot and then uses the pitch value plus some basic trigonometry to feed the correct value into aim()

//our variables
object KillMe;
float range;
float ZDif;
float absoluteElevation;
float correctedElevation;


//calculate the angle we need to adjust our cannon
range = distance(this.position, KillMe.position);
absoluteElevation = atan((KillMe.position.z - position.z)/distance(this.position,KillMe.position));
correctedElevation = absoluteElevation - pitch;

aim(correctedElevation);
fire(0.1);

Obviously, it doesn't take into account the min/max elevations for the particular bot weapon you're using, or the min-max range of it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文