做一个缓慢的漂移动作,用于一个物理学组的 phaser.js。

huangapple go评论57阅读模式
英文:

Make a slow drifting motion for a physics group phaser.js

问题

我有一个物理组,速度非常低,就像child.setVelocity(1, 10);。如果这个组的子物体因更快的组碰撞而加速,那没关系,但我希望它们非常缓慢,基本上不受重力影响,但仍然移动,不会因下落而加速,有没有办法做到这一点?

英文:

So I have a physics group, with a very low velocity like child.setVelocity(1, 10);

It's fine if this groups children speed up from a faster group collision, but I would like them to be very slow, basically unaffected by gravity but still moving, not speeding up by falling down, is there anyway to do that?

答案1

得分: 1

你可以使用函数 gameobject.setAllowGravity(false) 来关闭一个游戏对象的重力。文档链接

或者如果你在一个物理组中使用它,你可以使用属性 allowGravity 并将其设置为 false文档链接

英文:

You can turn of the gravity of one gameobject with the fucntion gameobject.setAllowGravity(false)
link to the documentation.

Or if you are using it in a physics group, you can use the property allowGravity and set it to false.
link to the documentation

huangapple
  • 本文由 发表于 2023年6月13日 12:50:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76461774.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定