基于物理的游戏将会有一些你想要移动的实例,但不希望被诸如重力等力和与动态物体碰撞所产生的力量所影响(例如,在平台游戏中考虑移动平台)。For such objects simply setting the density of a fixture to 0 will mean that the physics will assume that the object is intended to be static. However, should you set the phy_speed_x, phy_speed_y or phy_angular_velocity variables for an instance that has had such a fixture bound to it, it will be converted into a kinematic object and begin movement. Change the instance from static to kinematic mid-simulation can be expensive in terms of processing (depending on the state of the instances in the physics world) and therefore it is recommended to set the fixture to be kinematic using this function prior to binding it to an instance, so that it will be unaffected by collisions and forces (such as gravity) but may move with constant linear and/or angular velocity.
physics_fixture_set_kinematic(fixture)
参数 | 描述 |
---|---|
fixture | the index of the fixture |
N/A(无返回值)
physics_fixture_set_kinematic(fix_Cloud);
The code above will indicate that the fixture indexed in "fix_Cloud" should be marked as kinematic.