Away3D Forum http://away3d.com/forum/ Away3D Forum en Copyright 2015 2015-07-14T13:30:55+00:00 rigidbody go through the wall after applyCentralImpulse http://away3d.com/forum/viewthread/4720/ http://away3d.com/forum/viewthread/4720/#When:04:25:57Z <p>i am implementing an air hockey game using AwayPhysics</p> <p>when the puck collide with the stick, i add central impulse to the puck</p> <p>sometimes the puck will go through static rigid walls i set in the scene</p> <p>and this often occurs when the puck moves fast</p> <p>i am a newbie to AwayPhysics and i think the reason for this is that </p> <p>the position simulated has already out of walls</p> <p>but i don’t know how to adjust that</p> <p>could anyone help me, thanks!!</p> 2013-07-11T04:25:57+00:00 Both side and anta-alias issue with Flash Player 14 in Chrome http://away3d.com/forum/viewthread/5605/ http://away3d.com/forum/viewthread/5605/#When:10:22:06Z <p>Hi everyone !</p> <p>Today, i updated a Away3D project developped a few month ago.<br /> I was surprised with the bad render of the 3ds objects in the scene. The both side no longer work and rendering is not quality. <br /> Look at the attached file to understand the issue.</p> <p>At first my Flash project run with Away3D 4.1.5. I have updated to 4.1.6 but the problem persists.</p> <p>The problem come with the new version of Flash Player in Chrome v14.0 !</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #FF8000">//Setup&nbsp;Scene<br /></span><span style="color: #0000BB">_scene&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Scene3D</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">_camera&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Camera3D</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">_view&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">View3D</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">antiAlias&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">scene&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_scene</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_camera</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">mousePicker&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PickingType</span><span style="color: #007700">.</span><span style="color: #0000BB">RAYCAST_BEST_HIT</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">backgroundColor&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0x131313</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//Mesh&nbsp;setting&nbsp;example<br /><br /></span><span style="color: #0000BB">mesh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">(</span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">target</span><span style="color: #007700">.</span><span style="color: #0000BB">getChildAt</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">pickingCollider&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PickingColliderType</span><span style="color: #007700">.</span><span style="color: #0000BB">PB_BEST_HIT</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">mouseEnabled&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">shaderPickingDetails&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">geometry</span><span style="color: #007700">.</span><span style="color: #0000BB">convertToSeparateBuffers</span><span style="color: #007700">();<br /><br />var&nbsp;</span><span style="color: #0000BB">w</span><span style="color: #007700">:</span><span style="color: #0000BB">Weld&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Weld</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">w</span><span style="color: #007700">.</span><span style="color: #0000BB">apply</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />var&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">:</span><span style="color: #0000BB">Explode&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Explode</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">explode</span><span style="color: #007700">.</span><span style="color: #0000BB">apply</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">geometry</span><span style="color: #007700">);<br /><br />var&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">:</span><span style="color: #0000BB">TextureMaterial&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TextureMaterial</span><span style="color: #007700">(</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(</span><span style="color: #0000BB">pAmfPiece</span><span style="color: #007700">.</span><span style="color: #0000BB">textureDiffuseCustomBitmap</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #FF8000">//<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">specularMap&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">SpecularMap</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">Bitmap</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">normalMap&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">NormalMap</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">Bitmap</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">lightPicker&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_lightPicker</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">bothSides&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">specular&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.5</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">gloss&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.6</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">ambient&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.7</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">material&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">;&nbsp;</span> </span> </code></div> <p>Thanks</p> 2014-07-29T10:22:06+00:00 FLASH CS5.5how to use awayphysics.swc http://away3d.com/forum/viewthread/1354/ http://away3d.com/forum/viewthread/1354/#When:03:07:05Z <p>I set awayphysics.swc as libirary swc file ,when i debug it swf ,error said AWPRigidBody isn`t defined ,AWPPhysicsWorld isn`t denfined ...!when I locate awayphysice original file into root path ,error said module.AwayPhysica is unimprove initClid is un`t defined…!</p> <p>what should i do?</p> 2011-11-16T03:07:05+00:00 Error #1506: The specified range is invalid. http://away3d.com/forum/viewthread/5709/ http://away3d.com/forum/viewthread/5709/#When:01:45:28Z <p>When do quickly create AWPRigidBody and addRigidBody to world, had below issue.</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #0000BB">Error&nbsp;</span><span style="color: #FF8000">#1506:&nbsp;The&nbsp;specified&nbsp;range&nbsp;is&nbsp;invalid.&nbsp;</span> </span> </code></div> <p>Anybody know it?</p> 2014-11-04T01:45:28+00:00 Both side and anta-alias issue with Flash Player 14 in Chrome http://away3d.com/forum/viewthread/5604/ http://away3d.com/forum/viewthread/5604/#When:10:19:32Z <p>Hi everyone !</p> <p>Today, i updated a Away3D project developped a few month ago.<br /> I was surprised with the bad render of the 3ds objects in the scene. The both side no longer work and rendering is not quality. <br /> Look at the attached file to understand the issue.</p> <p>At first my Flash project run with Away3D 4.1.5. I have updated to 4.1.6 but the problem persists.</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #FF8000">//Setup&nbsp;Scene<br /></span><span style="color: #0000BB">_scene&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Scene3D</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">_camera&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Camera3D</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">_view&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">View3D</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">antiAlias&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">scene&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_scene</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_camera</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">mousePicker&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PickingType</span><span style="color: #007700">.</span><span style="color: #0000BB">RAYCAST_BEST_HIT</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">backgroundColor&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0x131313</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//Mesh&nbsp;setting&nbsp;example<br /><br /></span><span style="color: #0000BB">mesh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">(</span><span style="color: #0000BB">e</span><span style="color: #007700">.</span><span style="color: #0000BB">target</span><span style="color: #007700">.</span><span style="color: #0000BB">getChildAt</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">pickingCollider&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PickingColliderType</span><span style="color: #007700">.</span><span style="color: #0000BB">PB_BEST_HIT</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">mouseEnabled&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">shaderPickingDetails&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">geometry</span><span style="color: #007700">.</span><span style="color: #0000BB">convertToSeparateBuffers</span><span style="color: #007700">();<br /><br />var&nbsp;</span><span style="color: #0000BB">w</span><span style="color: #007700">:</span><span style="color: #0000BB">Weld&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Weld</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">w</span><span style="color: #007700">.</span><span style="color: #0000BB">apply</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />var&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">:</span><span style="color: #0000BB">Explode&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Explode</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">explode</span><span style="color: #007700">.</span><span style="color: #0000BB">apply</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">geometry</span><span style="color: #007700">);<br /><br />var&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">:</span><span style="color: #0000BB">TextureMaterial&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TextureMaterial</span><span style="color: #007700">(</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(</span><span style="color: #0000BB">pAmfPiece</span><span style="color: #007700">.</span><span style="color: #0000BB">textureDiffuseCustomBitmap</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #FF8000">//<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">specularMap&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">SpecularMap</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">Bitmap</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">normalMap&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Cast</span><span style="color: #007700">.</span><span style="color: #0000BB">bitmapTexture</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">NormalMap</span><span style="color: #007700">()&nbsp;as&nbsp;</span><span style="color: #0000BB">Bitmap</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">lightPicker&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_lightPicker</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">bothSides&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">specular&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.5</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">gloss&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.6</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">ambient&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.7</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">material&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">;&nbsp;</span> </span> </code></div> <p>Thanks</p> 2014-07-29T10:19:32+00:00 Object go through other Object. http://away3d.com/forum/viewthread/5528/ http://away3d.com/forum/viewthread/5528/#When:12:02:49Z <p>Am making a game to catch coocckies which is falling from the sky. Am able add awayPhysics .Now the cookies falling from the sky and created a box which catch the coockies. But the problem is the coockies inside the box go throuh the box walls when i move fast the Box.&nbsp; I adjusted the mass value . But still is not working .. this is my code :</p> <p><a href="http://pastebin.com/PS9RDSrL">http://pastebin.com/PS9RDSrL</a></p> 2014-06-06T12:02:49+00:00 AWPBvhTriangleMeshShape surface is not smooth http://away3d.com/forum/viewthread/5128/ http://away3d.com/forum/viewthread/5128/#When:20:46:39Z <p>Hi there,</p> <p>I am creating a ball game, where a ball follows a way. The way is a AWPBvhTriangleMeshShape. But unfortunately, the ball jumps up and changes its direction when it is rolling over edges - even if the surface is flat.</p> <p>I have created a project to reproduce this behaviour. There is a PlaneGeometry and a SphereGeometry. When moving the ball, it starts to jump at the edges of the plane surface.</p> <p><br /> I have uploaded a movie of the project, where you can see the ball jumps up: <a href="http://de.tinypic.com/r/2ibymh5/5">http://de.tinypic.com/r/2ibymh5/5</a></p> <p>Is this a bug or is there a solution to get rid of this problem? I really need the AWPBvhTriangleMeshShape, as the way is not a straight one.</p> <p><br /> Here is the code, woul’d be very happy is someone coul’d help me out.</p> <div class="codeblock"><code><span style="color: #000000"> <span style="color: #0000BB">package<br />{<br />&nbsp;import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">display</span><span style="color: #007700">.</span><span style="color: #0000BB">Sprite</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">events</span><span style="color: #007700">.</span><span style="color: #0000BB">Event</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">events</span><span style="color: #007700">.</span><span style="color: #0000BB">KeyboardEvent</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">geom</span><span style="color: #007700">.</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">.</span><span style="color: #0000BB">TextField</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">text</span><span style="color: #007700">.</span><span style="color: #0000BB">TextFormat</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;flash</span><span style="color: #007700">.</span><span style="color: #0000BB">ui</span><span style="color: #007700">.</span><span style="color: #0000BB">Keyboard</span><span style="color: #007700">;<br />&nbsp;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">containers</span><span style="color: #007700">.</span><span style="color: #0000BB">View3D</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">debug</span><span style="color: #007700">.</span><span style="color: #0000BB">AwayStats</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">entities</span><span style="color: #007700">.</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">lights</span><span style="color: #007700">.</span><span style="color: #0000BB">PointLight</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">materials</span><span style="color: #007700">.</span><span style="color: #0000BB">ColorMaterial</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">materials</span><span style="color: #007700">.</span><span style="color: #0000BB">lightpickers</span><span style="color: #007700">.</span><span style="color: #0000BB">StaticLightPicker</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">primitives</span><span style="color: #007700">.</span><span style="color: #0000BB">PlaneGeometry</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;away3d</span><span style="color: #007700">.</span><span style="color: #0000BB">primitives</span><span style="color: #007700">.</span><span style="color: #0000BB">SphereGeometry</span><span style="color: #007700">;<br />&nbsp;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;awayphysics</span><span style="color: #007700">.</span><span style="color: #0000BB">collision</span><span style="color: #007700">.</span><span style="color: #0000BB">shapes</span><span style="color: #007700">.</span><span style="color: #0000BB">AWPBvhTriangleMeshShape</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;awayphysics</span><span style="color: #007700">.</span><span style="color: #0000BB">collision</span><span style="color: #007700">.</span><span style="color: #0000BB">shapes</span><span style="color: #007700">.</span><span style="color: #0000BB">AWPSphereShape</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;awayphysics</span><span style="color: #007700">.</span><span style="color: #0000BB">debug</span><span style="color: #007700">.</span><span style="color: #0000BB">AWPDebugDraw</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;awayphysics</span><span style="color: #007700">.</span><span style="color: #0000BB">dynamics</span><span style="color: #007700">.</span><span style="color: #0000BB">AWPDynamicsWorld</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">import&nbsp;awayphysics</span><span style="color: #007700">.</span><span style="color: #0000BB">dynamics</span><span style="color: #007700">.</span><span style="color: #0000BB">AWPRigidBody</span><span style="color: #007700">;<br />&nbsp;<br />&nbsp;</span><span style="color: #0000BB">[SWF</span><span style="color: #007700">(</span><span style="color: #0000BB">backgroundColor</span><span style="color: #007700">=</span><span style="color: #DD0000">"#000000"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">frameRate</span><span style="color: #007700">=</span><span style="color: #DD0000">"60"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">width</span><span style="color: #007700">=</span><span style="color: #DD0000">"600"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">height</span><span style="color: #007700">=</span><span style="color: #DD0000">"400"</span><span style="color: #007700">)</span><span style="color: #0000BB">]<br />&nbsp;</span><span style="color: #007700">public&nbsp;class&nbsp;</span><span style="color: #0000BB">BvhTriangleMesh&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">Sprite<br />&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;var&nbsp;</span><span style="color: #0000BB">_view&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">View3D</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_light&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">PointLight</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_lightPicker</span><span style="color: #007700">:</span><span style="color: #0000BB">StaticLightPicker</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_physicsWorld&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">AWPDynamicsWorld</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_debugDraw</span><span style="color: #007700">:</span><span style="color: #0000BB">AWPDebugDraw</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_timeStep&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Number&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1.0&nbsp;</span><span style="color: #007700">/&nbsp;</span><span style="color: #0000BB">60</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">:</span><span style="color: #0000BB">AWPRigidBody</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">:</span><span style="color: #0000BB">TextField</span><span style="color: #007700">;<br />&nbsp;&nbsp;private&nbsp;var&nbsp;</span><span style="color: #0000BB">_textFormat</span><span style="color: #007700">:</span><span style="color: #0000BB">TextFormat</span><span style="color: #007700">;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">BvhTriangleMesh</span><span style="color: #007700">()<br />&nbsp;&nbsp;</span><span style="color: #0000BB">{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">stage</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">init</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;else&nbsp;</span><span style="color: #0000BB">addEventListener</span><span style="color: #007700">(</span><span style="color: #0000BB">Event</span><span style="color: #007700">.</span><span style="color: #0000BB">ADDED_TO_STAGE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">init</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">init</span><span style="color: #007700">():</span><span style="color: #0000BB">void{<br />&nbsp;&nbsp;&nbsp;removeEventListener</span><span style="color: #007700">(</span><span style="color: #0000BB">Event</span><span style="color: #007700">.</span><span style="color: #0000BB">ADDED_TO_STAGE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">init</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">View3D</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">this</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(</span><span style="color: #0000BB">_view</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">this</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">AwayStats</span><span style="color: #007700">(</span><span style="color: #0000BB">_view</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_light&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PointLight</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_light</span><span style="color: #007700">.</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">5000</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">scene</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(</span><span style="color: #0000BB">_light</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_lightPicker&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">StaticLightPicker</span><span style="color: #007700">(</span><span style="color: #0000BB">[_light]</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">lens</span><span style="color: #007700">.</span><span style="color: #0000BB">far&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">20000</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">2000</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">z&nbsp;</span><span style="color: #007700">=&nbsp;-</span><span style="color: #0000BB">2000</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">rotationX&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">40</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;init&nbsp;the&nbsp;physics&nbsp;world<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_physicsWorld&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">AWPDynamicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">getInstance</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">initWithDbvtBroadphase</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_debugDraw&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPDebugDraw</span><span style="color: #007700">(</span><span style="color: #0000BB">_view</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">_physicsWorld</span><span style="color: #007700">);&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_debugDraw</span><span style="color: #007700">.</span><span style="color: #0000BB">debugMode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">AWPDebugDraw</span><span style="color: #007700">.</span><span style="color: #0000BB">DBG_NoDebug</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_debugDraw</span><span style="color: #007700">.</span><span style="color: #0000BB">debugMode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">AWPDebugDraw</span><span style="color: #007700">.</span><span style="color: #0000BB">DBG_DrawCollisionShapes</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">addObjects</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">stage</span><span style="color: #007700">.</span><span style="color: #0000BB">addEventListener</span><span style="color: #007700">(</span><span style="color: #0000BB">Event</span><span style="color: #007700">.</span><span style="color: #0000BB">ENTER_FRAME</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">onEnterFrame</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">stage</span><span style="color: #007700">.</span><span style="color: #0000BB">addEventListener</span><span style="color: #007700">(</span><span style="color: #0000BB">KeyboardEvent</span><span style="color: #007700">.</span><span style="color: #0000BB">KEY_DOWN</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">onDownHandler</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">addObjects</span><span style="color: #007700">():</span><span style="color: #0000BB">void{<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">material&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">ColorMaterial&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">ColorMaterial</span><span style="color: #007700">(</span><span style="color: #0000BB">0xfa6c16</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">.</span><span style="color: #0000BB">lightPicker&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_lightPicker</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">mesh&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Create&nbsp;plane:<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">iSeg</span><span style="color: #007700">:</span><span style="color: #0000BB">uint&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mesh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">PlaneGeometry</span><span style="color: #007700">(</span><span style="color: #0000BB">20000</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20000</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">iSeg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">iSeg</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">scene</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">triangleShape&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">AWPBvhTriangleMeshShape&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPBvhTriangleMeshShape</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">.</span><span style="color: #0000BB">geometry</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">planeBody</span><span style="color: #007700">:</span><span style="color: #0000BB">AWPRigidBody&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPRigidBody</span><span style="color: #007700">(</span><span style="color: #0000BB">triangleShape</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mesh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">planeBody</span><span style="color: #007700">.</span><span style="color: #0000BB">position&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">planeBody</span><span style="color: #007700">.</span><span style="color: #0000BB">restitution&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.5</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">addRigidBody</span><span style="color: #007700">(</span><span style="color: #0000BB">planeBody</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//Creat&nbsp;shpere:<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">sphereShape</span><span style="color: #007700">:</span><span style="color: #0000BB">AWPSphereShape&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPSphereShape</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">mesh&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mesh</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">SphereGeometry</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">material</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">scene</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(</span><span style="color: #0000BB">mesh</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_bodySphere&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPRigidBody</span><span style="color: #007700">(</span><span style="color: #0000BB">sphereShape</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mesh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">friction&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">.9</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">restitution&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0.9</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">position&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(-</span><span style="color: #0000BB">1000</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">600</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">addRigidBody</span><span style="color: #007700">(</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_textFormat&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TextFormat</span><span style="color: #007700">(</span><span style="color: #DD0000">'Arial'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xffffff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TextField</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">.</span><span style="color: #0000BB">x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">this</span><span style="color: #007700">.</span><span style="color: #0000BB">width</span><span style="color: #007700">/</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">.</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">.</span><span style="color: #0000BB">width&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">400</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">this</span><span style="color: #007700">.</span><span style="color: #0000BB">addChild</span><span style="color: #007700">(</span><span style="color: #0000BB">_text</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">onEnterFrame</span><span style="color: #007700">(</span><span style="color: #0000BB">e&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Event</span><span style="color: #007700">):</span><span style="color: #0000BB">void{<br />&nbsp;&nbsp;&nbsp;_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">step</span><span style="color: #007700">(</span><span style="color: #0000BB">_timeStep</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_debugDraw</span><span style="color: #007700">.</span><span style="color: #0000BB">debugDrawWorld</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">render</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">position&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">position</span><span style="color: #007700">.</span><span style="color: #0000BB">add</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2000</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">2500</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_view</span><span style="color: #007700">.</span><span style="color: #0000BB">camera</span><span style="color: #007700">.</span><span style="color: #0000BB">lookAt</span><span style="color: #007700">(</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">position</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">.</span><span style="color: #0000BB">text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"ball.y:&nbsp;"&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">position</span><span style="color: #007700">.</span><span style="color: #0000BB">y</span><span style="color: #007700">.</span><span style="color: #0000BB">toFixed</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">_text</span><span style="color: #007700">.</span><span style="color: #0000BB">setTextFormat</span><span style="color: #007700">(</span><span style="color: #0000BB">_textFormat</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">}<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">onDownHandler</span><span style="color: #007700">(</span><span style="color: #0000BB">event&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">KeyboardEvent</span><span style="color: #007700">):</span><span style="color: #0000BB">void{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">fForce</span><span style="color: #007700">:</span><span style="color: #0000BB">Number&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">event</span><span style="color: #007700">.</span><span style="color: #0000BB">keyCode</span><span style="color: #007700">==</span><span style="color: #0000BB">Keyboard</span><span style="color: #007700">.</span><span style="color: #0000BB">UP</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">applyCentralImpulse</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">fForce</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">event</span><span style="color: #007700">.</span><span style="color: #0000BB">keyCode</span><span style="color: #007700">==</span><span style="color: #0000BB">Keyboard</span><span style="color: #007700">.</span><span style="color: #0000BB">DOWN</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">applyCentralImpulse</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,-</span><span style="color: #0000BB">fForce</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">event</span><span style="color: #007700">.</span><span style="color: #0000BB">keyCode</span><span style="color: #007700">==</span><span style="color: #0000BB">Keyboard</span><span style="color: #007700">.</span><span style="color: #0000BB">LEFT</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">applyCentralImpulse</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(-</span><span style="color: #0000BB">fForce</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;if(</span><span style="color: #0000BB">event</span><span style="color: #007700">.</span><span style="color: #0000BB">keyCode</span><span style="color: #007700">==</span><span style="color: #0000BB">Keyboard</span><span style="color: #007700">.</span><span style="color: #0000BB">RIGHT</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">_bodySphere</span><span style="color: #007700">.</span><span style="color: #0000BB">applyCentralImpulse</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">fForce</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br />&nbsp;&nbsp;</span><span style="color: #0000BB">}<br />&nbsp;}<br />}&nbsp;</span> </span> </code></div> <p>&nbsp;</p> 2013-11-22T20:46:39+00:00 obj - AWPBvhTriangleMeshShape terrain problem http://away3d.com/forum/viewthread/3930/ http://away3d.com/forum/viewthread/3930/#When:19:55:49Z <p>Hi guys,</p> <p>Someone can see and eventually correct this…<br /> Here the source:<br /> <a href="http://www.estiva2.altervista.org/Away3D/CarSampleMod1.7z">http://www.estiva2.altervista.org/Away3D/CarSampleMod1.7z</a></p> <p>( the source contains two version of library incuded in the 7z file )</p> <p>This is important for me… With version 4.1 i can load the right material or/and texture but the physics can’t work…</p> <p>Thanks in advance <img src="/images/smileys/smile.gif" width="19" height="19" alt="smile" style="border:0;" /></p> 2013-02-01T19:55:49+00:00 AWPBvhTriangleMeshShape error http://away3d.com/forum/viewthread/4730/ http://away3d.com/forum/viewthread/4730/#When:02:55:06Z <p>Hi guys,</p> <p>Please help me with this problem:</p> <p>var mat:ColorMaterial = new ColorMaterial(0x4B871F);<br /> mat.lightPicker = stateLight;<br /> var mesh:Mesh = Mesh(ObjectContainer3D(e.target).getChildAt(0));<br /> //mesh.scale(100);<br /> mesh.material = mat;<br /> //view.scene.addChild(mesh);<br /> var shape:AWPBvhTriangleMeshShape = new AWPBvhTriangleMeshShape(mesh.geometry);<br /> var body:AWPRigidBody = new AWPRigidBody(shape, mesh, 0);<br /> body.scale = new Vector3D(40, 40, 40);<br /> world.addRigidBody(body);</p> <p>I’m using away4.1.1 and awayphysics-core-fp11-master</p> <p>Thanks!</p> 2013-07-14T02:55:06+00:00 6DofConstraint motor problem http://away3d.com/forum/viewthread/4591/ http://away3d.com/forum/viewthread/4591/#When:00:11:01Z <p>We are working on a project and were getting a random 1125 error in bullet. We decided to update to 4.1.1 beta and the dev branch of away physics. The update seem to fix the crash we were getting but we are now having a problem with one of our constraints with a translational motor not working. <br /> We have 2 of them set up one that slides back and forth along the Z axis it still works ok. The other slides along the Y axis up and down however it longer wants to move. I’ve tried increasing the velocity and motor force to no effect. Any one how any ideas? Heres the code that sets up the rigidbody and constraint. <br /> This was all working on the 4.0.11 alpha build with the master branch of awayphysics.</p><div class="codeblock"><code><span style="color: #000000"> <span style="color: #007700">var&nbsp;</span><span style="color: #0000BB">rigidbodyPiece&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Object&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Object</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">l_wall_pos&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Vector3D&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(-</span><span style="color: #0000BB">m_asset_wall_offset_x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">r_wall_pos&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Vector3D&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">m_asset_wall_offset_x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_l_wall_shape&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPBoxShape</span><span style="color: #007700">(</span><span style="color: #0000BB">m_asset_wall_width</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">m_asset_size</span><span style="color: #007700">.</span><span style="color: #0000BB">y</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">m_asset_size</span><span style="color: #007700">.</span><span style="color: #0000BB">z</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_r_wall_shape&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPBoxShape</span><span style="color: #007700">(</span><span style="color: #0000BB">m_asset_wall_width</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">m_asset_size</span><span style="color: #007700">.</span><span style="color: #0000BB">y</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">m_asset_size</span><span style="color: #007700">.</span><span style="color: #0000BB">z</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">shape&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPCompoundShape</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">shape</span><span style="color: #007700">.</span><span style="color: #0000BB">addChildShape</span><span style="color: #007700">(</span><span style="color: #0000BB">m_l_wall_shape</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">l_wall_pos</span><span style="color: #007700">,&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">shape</span><span style="color: #007700">.</span><span style="color: #0000BB">addChildShape</span><span style="color: #007700">(</span><span style="color: #0000BB">m_r_wall_shape</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">r_wall_pos</span><span style="color: #007700">,&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">rigidbody&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPRigidBody</span><span style="color: #007700">(</span><span style="color: #0000BB">shape</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">mesh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">gravity&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">super</span><span style="color: #007700">.</span><span style="color: #0000BB">initRigidbody</span><span style="color: #007700">(</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">WALL_Y_START</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">z&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">375</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//after&nbsp;tracing&nbsp;through&nbsp;for&nbsp;some&nbsp;reason&nbsp;the&nbsp;low&nbsp;y&nbsp;is<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//doubled&nbsp;so&nbsp;at&nbsp;-300&nbsp;it's&nbsp;actualy&nbsp;-600&nbsp;with&nbsp;out&nbsp;doubling<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//are&nbsp;low&nbsp;it&nbsp;was&nbsp;throwing&nbsp;off&nbsp;the&nbsp;high.&nbsp;The&nbsp;5&nbsp;is&nbsp;pull<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//the&nbsp;low/high&nbsp;in&nbsp;a&nbsp;little&nbsp;as&nbsp;they&nbsp;dont&nbsp;end&nbsp;up&nbsp;at&nbsp;exact&nbsp;values<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_wall_low_y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">WALL_Y_START&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_wall_high_y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">m_wall_low_y&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">m_asset_slide_distance&nbsp;</span><span style="color: #007700">-&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_wall_low_y&nbsp;</span><span style="color: #007700">+=&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">addRigidBodyWithGroup</span><span style="color: #007700">(</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SceneObject</span><span style="color: #007700">.</span><span style="color: #0000BB">GroundFloorGroup</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SceneObject</span><span style="color: #007700">.</span><span style="color: #0000BB">FloorCollisionMask</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AWPGeneric6DofConstraint</span><span style="color: #007700">(</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">position</span><span style="color: #007700">,&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">());<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">low&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Vector3D&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">y</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">z</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;</span><span style="color: #0000BB">high&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">Vector3D&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">m_asset_slide_distance</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">rigidbody</span><span style="color: #007700">.</span><span style="color: #0000BB">z</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">.</span><span style="color: #0000BB">setLinearLimit</span><span style="color: #007700">(</span><span style="color: #0000BB">low</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">high</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">.</span><span style="color: #0000BB">setAngularLimit</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">),&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">.</span><span style="color: #0000BB">getTranslationalLimitMotor</span><span style="color: #007700">().</span><span style="color: #0000BB">enableMotorY&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">.</span><span style="color: #0000BB">getTranslationalLimitMotor</span><span style="color: #007700">().</span><span style="color: #0000BB">targetVelocity&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">30</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">.</span><span style="color: #0000BB">getTranslationalLimitMotor</span><span style="color: #007700">().</span><span style="color: #0000BB">maxMotorForce&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Vector3D</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//rigidbody.position&nbsp;=&nbsp;new&nbsp;Vector3D(rigidbody.position.x,&nbsp;rigidbody.position.y&nbsp;+&nbsp;m_asset_slide_distance,&nbsp;rigidbody.position.z);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">m_physicsWorld</span><span style="color: #007700">.</span><span style="color: #0000BB">addConstraint</span><span style="color: #007700">(</span><span style="color: #0000BB">m_constraint</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);&nbsp;</span> </span> </code></div> 2013-06-04T00:11:01+00:00