You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DefoldDocs/api/collision_object.lua
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ function physics.get_gravity() end
38
38
39
39
---Returns the group name of a collision object as a hash.
40
40
---@paramurlstring|hash|url the collision object to return the group of.
41
-
---@returnhash hash value of the group. function checkIsEnemy() local grp= physics.get_group("#collisionobject") assert( grp== hash("enemy") ) end
41
+
---@returnhash hash value of the group. local function check_is_enemy() local group= physics.get_group("#collisionobject") return group== hash("enemy") end
42
42
functionphysics.get_group(url) end
43
43
44
44
---Get a table for properties for a connected joint. The joint has to be created before
@@ -69,7 +69,7 @@ function physics.get_joint_reaction_torque(collisionobject, joint_id) end
69
69
---object, false otherwise.
70
70
---@paramurlstring|hash|url the collision object to check the mask of.
71
71
---@paramgroupstring the name of the group to check for.
72
-
---@returnboolean boolean value of the maskbit. 'true' if present, 'false' otherwise. function checkCollideWithUser() -- to check if the collisionobject would collide with "user" group local hits_user= physics.get_maskbit("#collisionobject","user") return hits_user end
72
+
---@returnboolean boolean value of the maskbit. 'true' if present, 'false' otherwise. local function is_invincible() -- check if the collisionobject would collide with the "bullet" group local invincible= physics.get_maskbit("#collisionobject","bullet") return invincible end
73
73
functionphysics.get_maskbit(url, group) end
74
74
75
75
---Ray casts are used to test for intersections against collision objects in the physics world.
@@ -111,7 +111,7 @@ function physics.set_gravity(gravity) end
111
111
---string value. The group name should exist i.e. have been used in
112
112
---a collision object in the editor.
113
113
---@paramurlstring|hash|url the collision object affected.
114
-
---@paramgroupstring the new group name to be assigned. function changeCollisionGroup() physics.set_group("#collisionobject", "enemy") end
114
+
---@paramgroupstring the new group name to be assigned. local function change_collision_group() physics.set_group("#collisionobject", "enemy") end
115
115
functionphysics.set_group(url, group) end
116
116
117
117
---Flips the collision shapes horizontally for a collision object
@@ -130,8 +130,8 @@ function physics.set_joint_properties(collisionobject, joint_id, properties) end
130
130
---Sets or clears the masking of a group (maskbit) in a collision object.
131
131
---@paramurlstring|hash|url the collision object to change the mask of.
132
132
---@paramgroupstring the name of the group (maskbit) to modify in the mask.
133
-
---@paramtypebool boolean value of the new maskbit. 'true' to enable, 'false' to disable. function makeUserAlly() -- no longer collide with the "user" group physics.set_maskbit("#collisionobject","user",false) end
134
-
functionphysics.set_maskbit(url, group, type) end
133
+
---@parammaskbitboolean boolean value of the new maskbit. 'true' to enable, 'false' to disable. local function make_invincible() -- no longer collide with the "bullet" group physics.set_maskbit("#collisionobject","bullet", false) end
134
+
functionphysics.set_maskbit(url, group, maskbit) end
135
135
136
136
---Flips the collision shapes vertically for a collision object
137
137
---@paramurlstring|hash|url the collision object that should flip its shapes
0 commit comments