<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to make a Racing Car using Box2D in Javascript	</title>
	<atom:link href="https://www.binarytides.com/make-racing-car-box2d-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/make-racing-car-box2d-javascript/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Fri, 13 Jan 2023 08:52:19 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: peter		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-88979</link>

		<dc:creator><![CDATA[peter]]></dc:creator>
		<pubDate>Tue, 19 Jul 2016 17:52:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-88979</guid>

					<description><![CDATA[Hi, i copied function create_car() to my oop game, but wheel is rotating around body center not around won axis.]]></description>
			<content:encoded><![CDATA[<p>Hi, i copied function create_car() to my oop game, but wheel is rotating around body center not around won axis.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Silver Moon		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65203</link>

		<dc:creator><![CDATA[Silver Moon]]></dc:creator>
		<pubDate>Thu, 04 Apr 2013 16:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65203</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65196&quot;&gt;Varun Upadhyay&lt;/a&gt;.

use sensors. when the car is over the sensor, slow down the max speed of the car.
just set the isSensor property true on the fixture of the sensor shape. sensors will detect collision, but not collide physically.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65196">Varun Upadhyay</a>.</p>
<p>use sensors. when the car is over the sensor, slow down the max speed of the car.<br />
just set the isSensor property true on the fixture of the sensor shape. sensors will detect collision, but not collide physically.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65202</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Thu, 04 Apr 2013 10:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65202</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65193&quot;&gt;Roman&lt;/a&gt;.

i have created this for xCode, now. See this 


http://varunxcode.blogspot.in/2013/04/xcode-car-race-with-box2d.html]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65193">Roman</a>.</p>
<p>i have created this for xCode, now. See this </p>
<p><a href="http://varunxcode.blogspot.in/2013/04/xcode-car-race-with-box2d.html" rel="nofollow ugc">http://varunxcode.blogspot.in/2013/04/xcode-car-race-with-box2d.html</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65201</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Wed, 03 Apr 2013 06:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65201</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65196&quot;&gt;Varun Upadhyay&lt;/a&gt;.

just make that shape fixture definition sensor = true; like this

function createSensor(world, options)
{
   options = $.extend(true, {
        &#039;density&#039; : 1.0 ,
        &#039;friction&#039; : 0.0 ,
        &#039;restitution&#039; : 0.2 ,
        &#039;linearDamping&#039; : 0.0 ,
        &#039;angularDamping&#039; : 0.0 ,
        &#039;gravityScale&#039; : 1.0 ,
        &#039;type&#039; : b2Body.b2_dynamicBody
  }, options);

  var body_def = new b2BodyDef();
  var fix_def = new b2FixtureDef;
  fix_def.shape = new b2PolygonShape();
  var vertices = new Array(); 
  vertices[0] = new b2Vec2(3.24, 13.66); 
  vertices[1] = new b2Vec2(6.34, 14.50);
  vertices[2] = new b2Vec2(7.50, 13.35);
  vertices[3] = new b2Vec2(4.13, 13.00);
  fix_def.shape.SetAsArray(vertices, 4);
  fix_def.isSensor = true; //                       &#060;-------------------------------------------------
  world.CreateBody( body_def ).CreateFixture(fix_def);
  world.SetContactListener(listener);
}
var listener = new Box2D.Dynamics.b2ContactListener;
listener.BeginContact = function(contact) {
    // console.log(contact.GetFixtureA().GetBody().GetUserData());
}
listener.EndContact = function(contact) {
    // console.log(contact.GetFixtureA().GetBody().GetUserData());
}]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65196">Varun Upadhyay</a>.</p>
<p>just make that shape fixture definition sensor = true; like this</p>
<p>function createSensor(world, options)<br />
{<br />
   options = $.extend(true, {<br />
        &#8216;density&#8217; : 1.0 ,<br />
        &#8216;friction&#8217; : 0.0 ,<br />
        &#8216;restitution&#8217; : 0.2 ,<br />
        &#8216;linearDamping&#8217; : 0.0 ,<br />
        &#8216;angularDamping&#8217; : 0.0 ,<br />
        &#8216;gravityScale&#8217; : 1.0 ,<br />
        &#8216;type&#8217; : b2Body.b2_dynamicBody<br />
  }, options);</p>
<p>  var body_def = new b2BodyDef();<br />
  var fix_def = new b2FixtureDef;<br />
  fix_def.shape = new b2PolygonShape();<br />
  var vertices = new Array();<br />
  vertices[0] = new b2Vec2(3.24, 13.66);<br />
  vertices[1] = new b2Vec2(6.34, 14.50);<br />
  vertices[2] = new b2Vec2(7.50, 13.35);<br />
  vertices[3] = new b2Vec2(4.13, 13.00);<br />
  fix_def.shape.SetAsArray(vertices, 4);<br />
  fix_def.isSensor = true; //                       &lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
  world.CreateBody( body_def ).CreateFixture(fix_def);<br />
  world.SetContactListener(listener);<br />
}<br />
var listener = new Box2D.Dynamics.b2ContactListener;<br />
listener.BeginContact = function(contact) {<br />
    // console.log(contact.GetFixtureA().GetBody().GetUserData());<br />
}<br />
listener.EndContact = function(contact) {<br />
    // console.log(contact.GetFixtureA().GetBody().GetUserData());<br />
}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65200</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Wed, 03 Apr 2013 06:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65200</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65199&quot;&gt;Varun Upadhyay&lt;/a&gt;.

use .R -&#062; .q, .R.col1 -&#062; .q.GetXAxis() and .R.col2 became .q.GetYAxis()]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65199">Varun Upadhyay</a>.</p>
<p>use .R -&gt; .q, .R.col1 -&gt; .q.GetXAxis() and .R.col2 became .q.GetYAxis()</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65199</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Tue, 02 Apr 2013 09:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65199</guid>

					<description><![CDATA[how can we use wheel.GetTransform().R.col2.Copy() (line 332) in Xcode? please help]]></description>
			<content:encoded><![CDATA[<p>how can we use wheel.GetTransform().R.col2.Copy() (line 332) in Xcode? please help</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65198</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Tue, 02 Apr 2013 07:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65198</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65193&quot;&gt;Roman&lt;/a&gt;.

Did you get any help in xCode? please let me know, if you get the code for xCode]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65193">Roman</a>.</p>
<p>Did you get any help in xCode? please let me know, if you get the code for xCode</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65197</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Mon, 25 Mar 2013 08:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65197</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65195&quot;&gt;edd&lt;/a&gt;.

i have resolved this problem. Just go in redraw_world function and write following code

context.clearRect(0, 0, 500, 300);//Area of your canvas
context.save();
//maxY is the max position by car (extreme top) same with maxX(extreme right) in b2vec2 coordinate. &quot;wd&quot; is canvas width, &quot;ht&quot; is canvas height, zoomLevel 1 by default (canvas zoom actually)
    context.translate(((car.body.GetPosition().x*wd)/maxX)*zoomLevel,((ht)-(car.body.GetPosition().y*ht/19.18))*zoomLevel);

    context.rotate(-car.body.GetAngle());

    context.drawImage(carImage,-carImage.width/2, -carImage.height/2);//(((car.body.GetPosition().x*wd)/maxX)-carImage.width/2),((ht)-(car.body.GetPosition().y*ht/19.18)-carImage.height/2));

    context.restore();]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65195">edd</a>.</p>
<p>i have resolved this problem. Just go in redraw_world function and write following code</p>
<p>context.clearRect(0, 0, 500, 300);//Area of your canvas<br />
context.save();<br />
//maxY is the max position by car (extreme top) same with maxX(extreme right) in b2vec2 coordinate. &#8220;wd&#8221; is canvas width, &#8220;ht&#8221; is canvas height, zoomLevel 1 by default (canvas zoom actually)<br />
    context.translate(((car.body.GetPosition().x*wd)/maxX)*zoomLevel,((ht)-(car.body.GetPosition().y*ht/19.18))*zoomLevel);</p>
<p>    context.rotate(-car.body.GetAngle());</p>
<p>    context.drawImage(carImage,-carImage.width/2, -carImage.height/2);//(((car.body.GetPosition().x*wd)/maxX)-carImage.width/2),((ht)-(car.body.GetPosition().y*ht/19.18)-carImage.height/2));</p>
<p>    context.restore();</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Varun Upadhyay		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65196</link>

		<dc:creator><![CDATA[Varun Upadhyay]]></dc:creator>
		<pubDate>Mon, 25 Mar 2013 08:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65196</guid>

					<description><![CDATA[how to add shapes, where Car goes over that and Car speed will become slow?]]></description>
			<content:encoded><![CDATA[<p>how to add shapes, where Car goes over that and Car speed will become slow?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: edd		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65195</link>

		<dc:creator><![CDATA[edd]]></dc:creator>
		<pubDate>Sun, 17 Feb 2013 19:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65195</guid>

					<description><![CDATA[I am having a great trouble in adding an image to the car body.Please help]]></description>
			<content:encoded><![CDATA[<p>I am having a great trouble in adding an image to the car body.Please help</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sazzadcsedu		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65194</link>

		<dc:creator><![CDATA[sazzadcsedu]]></dc:creator>
		<pubDate>Tue, 20 Dec 2011 10:50:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65194</guid>

					<description><![CDATA[Awesome , so realistic simulation. Thanks  a lot.]]></description>
			<content:encoded><![CDATA[<p>Awesome , so realistic simulation. Thanks  a lot.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Roman		</title>
		<link>https://www.binarytides.com/make-racing-car-box2d-javascript/comment-page-1/#comment-65193</link>

		<dc:creator><![CDATA[Roman]]></dc:creator>
		<pubDate>Tue, 13 Dec 2011 21:04:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=401#comment-65193</guid>

					<description><![CDATA[Wow amazing what you created there. 
Currently i am trying to make something similar in cocos2d.
Helped me, thx.]]></description>
			<content:encoded><![CDATA[<p>Wow amazing what you created there.<br />
Currently i am trying to make something similar in cocos2d.<br />
Helped me, thx.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
