Difference between revisions of "B2.ChainShape"
From GiderosMobile
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
+ | <!-- GIDEROSOBJ:b2.ChainShape --> | ||
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/> | '''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]]<br/> | ||
'''<translate>Available since</translate>:''' Gideros 2012.2.2<br/> | '''<translate>Available since</translate>:''' Gideros 2012.2.2<br/> | ||
Line 28: | Line 29: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Methods</translate> === | === <translate>Methods</translate> === | ||
− | [[Special:MyLanguage/b2.ChainShape.new|b2.ChainShape.new]] <br/> | + | [[Special:MyLanguage/b2.ChainShape.new|b2.ChainShape.new]] <br/><!-- GIDEROSMTD:b2.ChainShape.new --> |
− | [[Special:MyLanguage/b2.ChainShape:createChain|b2.ChainShape:createChain]] ''<translate>creates a chain with isolated end vertices</translate>''<br/> | + | [[Special:MyLanguage/b2.ChainShape:createChain|b2.ChainShape:createChain]] ''<translate>creates a chain with isolated end vertices</translate>''<br/><!-- GIDEROSMTD:b2.ChainShape:createChain --> |
− | [[Special:MyLanguage/b2.ChainShape:createLoop|b2.ChainShape:createLoop]] ''<translate>creates a loop</translate>''<br/> | + | [[Special:MyLanguage/b2.ChainShape:createLoop|b2.ChainShape:createLoop]] ''<translate>creates a loop</translate>''<br/><!-- GIDEROSMTD:b2.ChainShape:createLoop --> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
=== <translate>Constants</translate> === | === <translate>Constants</translate> === | ||
|} | |} |
Revision as of 14:54, 31 August 2018
Supported platforms:
Available since: Gideros 2012.2.2
Inherits from: b2.Shape
Description
A chain shape is a free form sequence of line segments. The chain has two-sided collision, so you can use inside
and outside collision. Therefore, you may use any winding order. Connectivity information is used to create smooth collisions.
<ul>
<li>*Note:** The chain will not collide properly if there are self-intersections.</li>
</ul>
Examples
Create world bounds using ChainShape
local body = world:createBody{type = b2.STATIC_BODY}
body:setPosition(0, 0)
local chain = b2.ChainShape.new()
chain:createLoop(
0,0,
application:getContentWidth(), 0,
application:getContentWidth(), application:getContentHeight(),
0, application:getContentHeight()
)
local fixture = body:createFixture{shape = chain, density = 1.0,
friction = 1, restitution = 0.3}
Methodsb2.ChainShape.new |
EventsConstants |