Difference between revisions of "B2.WorldManifold"

From GiderosMobile
Line 4: Line 4:
 
'''<translate>Supported platforms</translate>:''' [[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/>
 
'''<translate>Supported platforms</translate>:''' [[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/>
 
'''<translate>Available since</translate>:''' Gideros 2012.09.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2012.09.6<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate>Contains information about contact relative to the world</translate>
+
Contains information about contact relative to the world.
 +
 
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
'''Checking collisions from bottom using b2.Contact'''<br/>
+
'''Checking collisions from bottom using b2.Contact'''
<source lang="lua">local isTouchingGround = false
+
<source 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 23: Line 26:
 
isTouchingGround = false
 
isTouchingGround = false
 
end
 
end
end)</source>
+
end)
'''Example content of b2.WorldManifold'''<br/>
+
</source>
<source lang="lua">[normal] => Table {
+
 
 +
'''Example content of b2.WorldManifold'''
 +
<source lang="lua">
 +
[normal] => Table {
 
         {
 
         {
 
           [y] => -1
 
           [y] => -1
Line 37: Line 43:
 
               [x] => 99.999997615814
 
               [x] => 99.999997615814
 
             }
 
             }
         }</source>
+
         }
 +
</source>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
 +
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
Line 47: Line 56:
 
[[Special:MyLanguage/points|points]]<br/><!-- GIDEROSCST:points table-->
 
[[Special:MyLanguage/points|points]]<br/><!-- GIDEROSCST:points table-->
 
|}
 
|}
 +
 +
----
 +
*'''[[LiquidFun]]'''

Revision as of 16:42, 18 February 2020


Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
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

Events

Constants

normal
points