【问题标题】:set angular velocity not working in andengine设置角速度在andengine中不起作用
【发布时间】:2023-03-26 23:48:01
【问题描述】:

我正在尝试在 andengine 中做类似飞扬小鸟的游戏。我实现了一切,一切都解决了,但轮换不起作用。设置角速度不起作用

我的代码如下

onscenetouch 我给出的线速度如下

body.setLinearVelocity(new Vector2(2, 2)); 
 float omegaFactor = (float) -1.0;
 body.setAngularVelocity((float) ( (Math.PI) * omegaFactor) ); 

请告诉我我做错了什么。

【问题讨论】:

  • 你检查过你的身体了吗?可能是轮换“关闭”了?
  • 哦,我终于明白了。物理连接器有一个布尔更新旋转参数。在我的游戏中它是错误的。

标签: android rotation andengine physics velocity


【解决方案1】:

物理连接器有一个布尔参数,表示身体旋转的更新。

不幸的是,这在我的游戏中是错误的。我将其更改为 true 并且有效。

physicsWorld.registerPhysicsConnector(new PhysicsConnector(levelObject, body, true, false));

physicsWorld.registerPhysicsConnector(new PhysicsConnector(levelObject, body, true, true));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-17
    • 1970-01-01
    • 1970-01-01
    • 2020-10-14
    • 1970-01-01
    • 1970-01-01
    • 2020-09-28
    相关资源
    最近更新 更多