B2.WorldManifold: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| (10 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Supported platforms:''' <br/> | <!-- GIDEROSOBJ:b2.WorldManifold --> | ||
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> | |||
'''Available since:''' Gideros 2012.09.6<br/> | '''Available since:''' Gideros 2012.09.6<br/> | ||
=== Description === | === Description === | ||
Contains information about contact relative to the world. | |||
=== Examples === | === Examples === | ||
'''Checking collisions from bottom using b2.Contact''' | '''Checking collisions from bottom using b2.Contact''' | ||
< | <syntaxhighlight lang="lua"> | ||
local isTouchingGround = false | |||
world:addEventListener(Event.BEGIN_CONTACT, function(e) | world:addEventListener(Event.BEGIN_CONTACT, function(e) | ||
local manifold = e.contact:getWorldManifold() | local manifold = e.contact:getWorldManifold() | ||
| Line 21: | Line 25: | ||
isTouchingGround = false | isTouchingGround = false | ||
end | end | ||
end)</ | end) | ||
'''Example content of b2.WorldManifold''' | </syntaxhighlight> | ||
< | |||
'''Example content of b2.WorldManifold''' | |||
<syntaxhighlight lang="lua"> | |||
[normal] => Table { | |||
{ | { | ||
[y] => -1 | [y] => -1 | ||
| Line 35: | Line 42: | ||
[x] => 99.999997615814 | [x] => 99.999997615814 | ||
} | } | ||
}</ | } | ||
</syntaxhighlight> | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
[[normal]]<br/> | [[normal]]<br/><!--GIDEROSCST:normal table--> | ||
[[points]]<br/> | [[points]]<br/><!--GIDEROSCST:points table--> | ||
|} | |} | ||
---- | |||
*'''[[LiquidFun]]''' | |||
Latest revision as of 01:06, 1 December 2023
Supported platforms: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2012.09.6
Description
Contains information about contact relative to the world.
Examples
Checking collisions from bottom using b2.Contact
local isTouchingGround = false
world:addEventListener(Event.BEGIN_CONTACT, function(e)
local manifold = e.contact:getWorldManifold()
if manifold.normal.y > 0.9 then
--collision came from bottom
isTouchingGround = true
end
end)
world:addEventListener(Event.END_CONTACT, function(e)
local manifold = e.contact:getWorldManifold()
if manifold.normal.y < 0.1 then
--collision ended from bottom
isTouchingGround = false
end
end)
Example content of b2.WorldManifold
[normal] => Table {
{
[y] => -1
[x] => 0
}
[points] => Table {
{
[1] => Table {
{
[y] => 319.92502212524
[x] => 99.999997615814
}
}
Methods |
EventsConstants |