<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>JigLibX - new forum posts</title>
		<link>http://jiglibx.wikidot.com/forum/start</link>
		<description>Posts in forums of the site &quot;JigLibX&quot; - The XNA C# Collision and Physics Solution</description>
				<copyright></copyright>
		<lastBuildDate></lastBuildDate>
		
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196596#post-644174</guid>
				<title>Re: RC-AirSim: r/c model airplane flight simulator</title>
				<link>http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator#post-644174</link>
				<description></description>
				<pubDate>Sun, 29 Nov 2009 05:28:11 +0000</pubDate>
				<wikidot:authorName>SomeCallMeTim</wikidot:authorName>				<wikidot:authorUserId>274272</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks guys!</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-33556">General / Showcase</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator">RC-AirSim: r/c model airplane flight simulator</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196134#post-644158</guid>
				<title>Re: how to move objects?</title>
				<link>http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects#post-644158</link>
				<description></description>
				<pubDate>Sun, 29 Nov 2009 03:50:36 +0000</pubDate>
				<wikidot:authorName>Juice118</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hey Ali. Something I am sure we all had trouble with when first using JigLibx.</p> <p>2 Options.</p> <p>1) Use PhysicsBody.Addbodyimpulse. (should work for you straight up - without any controllers or anything so long as you are updating the system correctly) Trouble with impulse is it is not very realistic in that it basically applies an 'immediate' force in the direction you specify ie. objects goes from 0 - 100 in 0 seconds.</p> <p>2) Use forces. You will need to create a controller. A controller can be very simple. For example:</p> <p>public override void UpdateController(float dt)<br /> {<br /> ObjectDirection = TargetObject - ObjectPosition; //this could be any vector3<br /> ObjectDirection.Normalize(); //must normalize else force will be greater than 1.<br /> force = new Vector3((ObjectDirection.X, ObjectDirection.Y, ObjectDirection.Z) * Power)</p> <p>if (Object == null)<br /> return;</p> <p>if (force != null &amp;&amp; force != Vector3.Zero)<br /> {<br /> Object.PhysicsBody.AddBodyForce(force);<br /> }<br /> force = Vector3.Zero; // otherwise force will be added again next update</p> <p><em>you can put all your if statements in there to make sure the force is only applied when certain //conditions are met.<br /></em>and remember by default your object may be set to inactive and gravity on, you may need to //alter these depending on your desired use.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects">how to move objects?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-200494#post-644105</guid>
				<title>HingeJoint Question</title>
				<link>http://jiglibx.wikidot.com/forum/t-200494/hingejoint-question#post-644105</link>
				<description></description>
				<pubDate>Sun, 29 Nov 2009 00:46:04 +0000</pubDate>
				<wikidot:authorName>DevanDanger</wikidot:authorName>				<wikidot:authorUserId>362271</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I'm using a controller which is based on the hinge joint since I need some custom body force/torque added through user input. I have all of the input working correctly to created rotations around this constraining body. The only problem I'm having is that I want to be able to move the constraining (body0) body subsequently moving the controlling body (body1) around while still constraining its relative position/rotations.</p> <p>I'm getting close to the action I want however while moving the constraining body it causes a temporarily shake to the controlled body. I'm looking for way to prevent this. Any thoughts?</p> <p>Can post a video to explain better if needed.<br /> Also this is how I'm moving the constraining body, I'm assuming I should be doing this differently. Experimented a couple of ways to no avail.</p> <p>this.ConstrainedBody.Position = this.ConstrainedBody.Position += new Vector3(0, 0, .01f);</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-200494/hingejoint-question">HingeJoint Question</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-200312#post-643670</guid>
				<title>Collisions at origin? Why?</title>
				<link>http://jiglibx.wikidot.com/forum/t-200312/collisions-at-origin-why#post-643670</link>
				<description></description>
				<pubDate>Sat, 28 Nov 2009 02:32:10 +0000</pubDate>
				<wikidot:authorName>Joeinator</wikidot:authorName>				<wikidot:authorUserId>408649</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I've just completed the Basic World tutorial, and when I debug it, the two boxes don't collide with the outside of each other. Instead, the outsides of each box only collide with the origin of the other.<br /> Why is this happening? And how do I fix it?<br /> -Thanks</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-200312/collisions-at-origin-why">Collisions at origin? Why?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-188550#post-643669</guid>
				<title>Re: Basic World</title>
				<link>http://jiglibx.wikidot.com/forum/t-188550/basic-world#post-643669</link>
				<description></description>
				<pubDate>Sat, 28 Nov 2009 02:29:20 +0000</pubDate>
				<wikidot:authorName>Joeinator</wikidot:authorName>				<wikidot:authorUserId>408649</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I found a way around this, though it's not very good. If you want to try :<br /> Open the class file called CollisionSkin.cs in the JigLibX project inside your solution. Find line 88:<br /> "Private int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)"<br /> and change the "Private" to "Public".</p> <p>I'm not really sure why this works, and whether or not it is a good thing to do, but it seems to compile like this. Hope that helps a bit.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-188550/basic-world">Basic World</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199441#post-642081</guid>
				<title>Re: TriangleMeshObject Error</title>
				<link>http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error#post-642081</link>
				<description></description>
				<pubDate>Wed, 25 Nov 2009 16:31:56 +0000</pubDate>
				<wikidot:authorName>ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>could the problem be that im not using the vertexprocesser.dll as i cant find it anywhere. but as i understand its not needed if getting vertex information the way i am. is that correct?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error">TriangleMeshObject Error</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199441#post-641888</guid>
				<title>Re: TriangleMeshObject Error</title>
				<link>http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error#post-641888</link>
				<description></description>
				<pubDate>Wed, 25 Nov 2009 11:29:15 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Still having no luck with this one. and cant seem to find what the problem is. for sum reason the error seems to go down into the octree. but i dont think the problem is there. could it be my jiglibx version?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error">TriangleMeshObject Error</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199716#post-641887</guid>
				<title>Re: Picking up objects and moving them.</title>
				<link>http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them#post-641887</link>
				<description></description>
				<pubDate>Wed, 25 Nov 2009 11:28:13 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Although i have this owkring now i would still like to get a deeper understanding on how its doing this as ive pinched it from a sample</p> <div class="code"> <pre> <code> physicSystem.CollisionSystem.SegmentIntersect(out frac, out skin, out pos, out normal, new Segment(cam.Position, ray * 1000.0f), pred); if (skin != null) { if (!skin.Owner.Immovable) { Vector3 delta = pos - skin.Owner.Position; delta = Vector3.Transform(delta, Matrix.Transpose(skin.Owner.Orientation)); camPickDistance = (cam.Position - pos).Length(); oldWheel = mouse.State.ScrollWheelValue; skin.Owner.SetActive(); objectController.Destroy(); damperController.Destroy(); objectController.Initialise(skin.Owner, delta, pos); damperController.Initialise(skin.Owner, ConstraintVelocity.ReferenceFrame.Body, Vector3.Zero, Vector3.Zero); objectController.EnableConstraint(); damperController.EnableConstraint(); } } middleButton = true; } if (objectController.IsConstraintEnabled &amp;&amp; (objectController.Body != null)) { Vector3 delta = objectController.Body.Position - cam.Position; Vector3 ray = RayTo((int)mouse.Position.X,(int)mouse.Position.Y); ray.Normalize(); float deltaWheel = mouse.State.ScrollWheelValue - oldWheel; camPickDistance += deltaWheel * 0.01f; Vector3 result = cam.Position + camPickDistance * ray; oldWheel = mouse.State.ScrollWheelValue; objectController.WorldPosition = result; objectController.Body.SetActive(); } } else { objectController.DisableConstraint(); damperController.DisableConstraint(); middleButton = false; } #endregion</code> </pre></div> <p>does anyone mind talking me though what the controllers and such are doing here. for example the damper and object controller. i assume one of those controllers is what keeping the object at the cam position or somthing?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them">Picking up objects and moving them.</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199716#post-641859</guid>
				<title>Re: Picking up objects and moving them.</title>
				<link>http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them#post-641859</link>
				<description></description>
				<pubDate>Wed, 25 Nov 2009 10:35:31 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Its amazing what you'll find when u try fix a problem for 6hrs straight into the early hours of the mourning :)</p> <p>it seems i have to use the inverse of my direction for it to work correctly, i assume this is to do with left and right hand co ord systems and the way my engine is setup, but i cud be wrong. i found that i could pick up objects by looking away from them. but by using hte inverse i can pick them up by looking in hte correct direction.</p> <p>just incase anyone else runs into a simular problem, hope that helps a lil</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them">Picking up objects and moving them.</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199716#post-641686</guid>
				<title>Picking up objects and moving them.</title>
				<link>http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them#post-641686</link>
				<description></description>
				<pubDate>Wed, 25 Nov 2009 02:51:10 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi. trying to implement a way to pick up and move objects around. sort of like a gravity gun, but when trying to implement the jigglegame example into my game, i get some wired behaviour.</p> <p>For 1, picking does not work 100%<br /> and when it does i am unable to pick up objects. if i try pick up a box and there ar e a few boxes around it, they all disappear and the game gets very slugish, hinting they are around doing sumthing strange. and sometimes i get a Nan error. really unsure why as ive pretty much copied the jigglegame example. only thing i have different is a terrain.</p> <p>heres the update code from my main page:</p> <div class="code"> <pre> <code> // for picking float camPickDistance = 0.0f; bool middleButton = false; int oldWheel = 0; public override void Update() { //physics.UpdatePhysics = true; mouseState = Mouse.GetState(); //mouseState = Mouse.GetState(); position.X = mouseState.X; position.Y = mouseState.Y; Viewport vp = Engine.GraphicsDevice.Viewport; if ((vp.X &lt;= position.X) &amp;&amp; (position.X &lt;= (vp.X + vp.Width)) &amp;&amp; (vp.Y &lt;= position.Y) &amp;&amp; (position.Y &lt;= (vp.Y + vp.Height))) { //position += mouse.Delta * 5* // (float)Engine.GameTime.ElapsedGameTime.TotalSeconds; position.X = MathHelper.Clamp(position.X, vp.X, vp.X + vp.Width); position.Y = MathHelper.Clamp(position.Y, vp.Y, vp.Y + vp.Height); } else if (mouse.Delta.LengthSquared() &gt; 0f) { position.X = vp.X + vp.Width / 2; position.Y = vp.Y + vp.Height / 2; } mouse.Position= new Vector2((int)position.X, (int)position.Y); //mouse.Update(); _pointer.Update(); Vector3 inputModifier = new Vector3( (keyboard.IsKeyDown(Keys.A) ? -1 : 0) + (keyboard.IsKeyDown(Keys.D) ? 1 : 0), (keyboard.IsKeyDown(Keys.Q) ? -1 : 0) + (keyboard.IsKeyDown(Keys.E) ? 1 : 0), (keyboard.IsKeyDown(Keys.W) ? -1 : 0) + (keyboard.IsKeyDown(Keys.S) ? 1 : 0) ); if (keyboard.IsKeyDown(Keys.M) &amp;&amp; keyboard.IsKeyUp(Keys.M)) { } #region Picking Objects with the mouse if (mouse.IsButtonDown(MouseButtons.Middle)) { if (middleButton == false) { Vector3 ray = RayTo((int)mouse.Position.X, (int)mouse.Position.Y); float frac; CollisionSkin skin; Vector3 pos, normal; ImmovableSkinPredicate pred = new ImmovableSkinPredicate(); physicSystem.CollisionSystem.SegmentIntersect(out frac, out skin, out pos, out normal, new Segment(cam.Position, ray * 1000.0f), pred); if (skin != null) { if (!skin.Owner.Immovable) { Vector3 delta = pos - skin.Owner.Position; delta = Vector3.Transform(delta, Matrix.Transpose(skin.Owner.Orientation)); camPickDistance = (cam.Position - pos).Length(); oldWheel = mouse.State.ScrollWheelValue; skin.Owner.SetActive(); objectController.Destroy(); damperController.Destroy(); objectController.Initialise(skin.Owner, delta, pos); damperController.Initialise(skin.Owner, ConstraintVelocity.ReferenceFrame.Body, Vector3.Zero, Vector3.Zero); objectController.EnableConstraint(); damperController.EnableConstraint(); } } middleButton = true; } if (objectController.IsConstraintEnabled &amp;&amp; (objectController.Body != null)) { Vector3 delta = objectController.Body.Position - cam.Position; Vector3 ray = RayTo((int)mouse.Position.X,(int)mouse.Position.Y); ray.Normalize(); float deltaWheel = mouse.State.ScrollWheelValue - oldWheel; camPickDistance += deltaWheel * 0.01f; Vector3 result = cam.Position + camPickDistance * ray; oldWheel = mouse.State.ScrollWheelValue; objectController.WorldPosition = result; objectController.Body.SetActive(); } } else { objectController.DisableConstraint(); damperController.DisableConstraint(); middleButton = false; } #endregion</code> </pre></div> <p>and the method for the ray</p> <div class="code"> <pre> <code> private Vector3 RayTo(int x, int y) { FPSCamera cam = (FPSCamera)Engine.Services.GetService&lt;Camera&gt;(); Vector3 nearSource = new Vector3(x, y, 0); Vector3 farSource = new Vector3(x, y, 1); Matrix world = Matrix.CreateTranslation(0, 0, 0); Vector3 nearPoint = Engine.GraphicsDevice.Viewport.Unproject(nearSource, cam.Projection, cam.View, world); Vector3 farPoint = Engine.GraphicsDevice.Viewport.Unproject(farSource, cam.Projection, cam.View, world); Vector3 direction = farPoint - nearPoint; // direction.Normalize(); return direction; } and my physics system is currently set up like: physicSystem = new PhysicsSystem(); physicSystem.CollisionSystem = new CollisionSystemGrid(32, 32, 32, 30, 30, 30); // physicSystem.CollisionSystem = new CollisionSystemSAP(); physicSystem.EnableFreezing = true; physicSystem.SolverType = PhysicsSystem.Solver.Normal; physicSystem.CollisionSystem.UseSweepTests = true; physicSystem.NumCollisionIterations = 8; physicSystem.NumContactIterations = 8; physicSystem.NumPenetrationRelaxtionTimesteps = 15; can anyone see any reason why this shouldnt work in the same way it does in the jigglegame, or is there a even better way of picking up objects. Thanks in advance.</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199716/picking-up-objects-and-moving-them">Picking up objects and moving them.</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199367#post-641525</guid>
				<title>Re: Problems with the car wheels and TriangleMeshObject</title>
				<link>http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject#post-641525</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 22:08:00 +0000</pubDate>
				<wikidot:authorName>e66n06</wikidot:authorName>				<wikidot:authorUserId>406783</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I got the source code from subversion a week or two ago.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject">Problems with the car wheels and TriangleMeshObject</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199367#post-641259</guid>
				<title>Re: Problems with the car wheels and TriangleMeshObject</title>
				<link>http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject#post-641259</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 16:00:41 +0000</pubDate>
				<wikidot:authorName>noone88</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>again, which version? the newest one directly from the subversion or the official download from the main page?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject">Problems with the car wheels and TriangleMeshObject</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196596#post-641258</guid>
				<title>Re: RC-AirSim: r/c model airplane flight simulator</title>
				<link>http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator#post-641258</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 15:58:22 +0000</pubDate>
				<wikidot:authorName>noone88</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>looks brilliant! :)</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-33556">General / Showcase</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator">RC-AirSim: r/c model airplane flight simulator</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199441#post-641142</guid>
				<title>Re: TriangleMeshObject Error</title>
				<link>http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error#post-641142</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 13:17:00 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>ive managed to narrow it down a bit further to</p> <p>triangleMesh.Octree.AddTriangles(vertexList, indexList);</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error">TriangleMeshObject Error</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199441#post-641138</guid>
				<title>Re: TriangleMeshObject Error</title>
				<link>http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error#post-641138</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 13:11:43 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>It seems no matter what i change in the trianglemesh class. i still get a error at the same line. ive tried replacing my whole trianglemesh class with another and problem is at same spot.</p> <p>triangleMesh.CreateMesh(vertexList, indexList, 4, 1.0f);</p> <p>Source array type cannot be assigned to destination array type.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error">TriangleMeshObject Error</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199441#post-640820</guid>
				<title>TriangleMeshObject Error</title>
				<link>http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error#post-640820</link>
				<description></description>
				<pubDate>Tue, 24 Nov 2009 02:22:42 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>cant get my triangle mesh objec to create a trianglemesh. here is my trainglemeshobject code</p> <div class="code"> <pre> <code>using System; using System.Collections.Generic; using JigLibX.Collision; using JigLibX.Geometry; using JigLibX.Math; using JigLibX.Physics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace qkGames { // A physics object that simulates all the individual polygons in a model public class TriangleMeshObject : PhysicsObject { // The generated mesh TriangleMesh triangleMesh; //string modelName; public List&lt;Vector3&gt; vertexList; // Constructors public List&lt;TriangleVertexIndices&gt; indexList; public TriangleMeshObject() : base() { Setup(null, Vector3.Zero, Vector3.Zero); } public TriangleMeshObject(string ModelName, Vector3 Position, Vector3 Rotation) : base() { Setup(ModelName, Position, Rotation); } public TriangleMeshObject(string ModelName, Vector3 Position, Vector3 Rotation, GameScreen Parent) : base(Parent) { Setup(ModelName, Position, Rotation); } // Sets up the object void Setup(string ModelName, Vector3 Position, Vector3 Rotation) { Model Model = Engine.Content.Load&lt;Model&gt;(ModelName); Body = new Body(); CollisionSkin = new CollisionSkin(null); //Body.CollisionSkin = CollisionSkin; //this.modelName = ModelName; //CollisionSkin.RemoveAllPrimitives(); triangleMesh = new TriangleMesh(); vertexList = new List&lt;Vector3&gt;(); indexList = new List&lt;TriangleVertexIndices&gt;(); ExtractData(vertexList, indexList, Model); //triangleMesh.CreateMesh( triangleMesh.CreateMesh(vertexList, indexList, 4, 1.0f); CollisionSkin.AddPrimitive(triangleMesh, new MaterialProperties(0.8f, 0.7f, 0.6f)); PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.AddCollisionSkin(CollisionSkin); //Mass = Mass; this.Position = Position; CollisionSkin.ApplyLocalTransform(new Transform(-Position, Matrix.Identity)); // CollisionSkin. //this.EulerRotation = Rotation; } // Sets the model being simulated, extracts vertices, etc. public void SetModel(string ModelName) { } // Extracts the neccesary information from a model to // simulate physics on it public void ExtractData(List&lt;Vector3&gt; vertices, List&lt;TriangleVertexIndices&gt; indices,Model model) { Matrix[] bones_ = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(bones_); foreach (ModelMesh mm in model.Meshes) { Matrix xform = bones_[mm.ParentBone.Index]; foreach (ModelMeshPart mmp in mm.MeshParts) { int offset = vertices.Count; Vector3[] a = new Vector3[mmp.NumVertices]; mm.VertexBuffer.GetData&lt;Vector3&gt;(mmp.StreamOffset + mmp.BaseVertex * mmp.VertexStride, a, 0, mmp.NumVertices, mmp.VertexStride); for (int i = 0; i != a.Length; ++i) Vector3.Transform(ref a[i], ref xform, out a[i]); vertices.AddRange(a); if (mm.IndexBuffer.IndexElementSize != IndexElementSize.SixteenBits) throw new Exception( String.Format("Model uses 32-bit indices, which are not supported.")); short[] s = new short[mmp.PrimitiveCount * 3]; mm.IndexBuffer.GetData&lt;short&gt;(mmp.StartIndex * 2, s, 0, mmp.PrimitiveCount * 3); JigLibX.Geometry.TriangleVertexIndices[] tvi = new JigLibX.Geometry.TriangleVertexIndices[mmp.PrimitiveCount]; for (int i = 0; i != tvi.Length; ++i) { tvi[i].I0 = s[i * 3 + 2] + offset; tvi[i].I1 = s[i * 3 + 1] + offset; tvi[i].I2 = s[i * 3 + 0] + offset; } indices.AddRange(tvi); } } } } }</code> </pre></div> <p>triangleMesh.CreateMesh(vertexList, indexList, 4, 1.0f);</p> <p>is throwing a<br /> System.ArrayTypeMismatchException was unhandled<br /> Message="Source array type cannot be assigned to destination array type."<br /> Source="mscorlib"<br /> StackTrace:<br /> at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)<br /> at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)<br /> at System.Collections.Generic.List`1.CopyTo(T[] array)<br /> at JigLibX.Geometry.Octree.AddTriangles(List`1 _positions, List`1 _tris)<br /> at JigLibX.Geometry.TriangleMesh.CreateMesh(List`1 vertices, List`1 triangleVertexIndices, Int32 maxTrianglesPerCell, Single minCellSize)</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199441/trianglemeshobject-error">TriangleMeshObject Error</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199367#post-640554</guid>
				<title>Problems with the car wheels and TriangleMeshObject</title>
				<link>http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject#post-640554</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 19:49:50 +0000</pubDate>
				<wikidot:authorName>e66n06</wikidot:authorName>				<wikidot:authorUserId>406783</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hello,</p> <p>I've just started playing around with this library and one of the first things I tried was to remove the heightmap and use a custom .x model as a Triangle Mesh Object instead, this seems to work fine for the cubes and spheres, however the car seems to have problems, the wheels sink though the mesh, and the the chassis stops the car falling through the world. Is there something obvious I could be doing wrong?</p> <p>Here's a few screen shots:</p> <img src="http://i68.photobucket.com/albums/i29/e66n06/car1.jpg" alt="car1.jpg" class="image" /><br /> <img src="http://i68.photobucket.com/albums/i29/e66n06/car2.jpg" alt="car2.jpg" class="image" /><br /> <img src="http://i68.photobucket.com/albums/i29/e66n06/car3.jpg" alt="car3.jpg" class="image" /> <p>Is this a known bug?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199367/problems-with-the-car-wheels-and-trianglemeshobject">Problems with the car wheels and TriangleMeshObject</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-640437</guid>
				<title>Re: Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-640437</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 17:24:42 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Thanks alot. i knew what the problem was i jus couldnt see it clearly. i added external data to my box object and it seems to be working. cant thank you enough for you fast and clear response. You dont have a more direct method of contacting you incase i run into more problems, or do you check these forums rather often.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-640435</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-640435</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 17:23:25 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Great. Good luck with JigLibX on xbox. If you are interested, i built a XBOX project out of the JigLibX sample and altered it to support the xbox gamepad.</p> <p>You should try to load it on your xbox when you get a chance, so you can get an idea of what you are up against when it comes to XBOX performance…..</p> <p>That project is NOT thelast stable release. Instead, it's the latest patch release, which is actually supposed to be faster on xbox…..</p> <p><a href="http://files.tsouris.net/fd/JigLibX_Xbox360/_zip.aspx">http://files.tsouris.net/fd/JigLibX_Xbox360/_zip.aspx</a></p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-640417</guid>
				<title>Re: Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-640417</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 17:02:39 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Well, ExternalData is NOT set by default. I see that you are setting ExternalData for your character, but nothing else is going to have it, so it's like saying:</p> <p>"I have external data, but nothing else i collide with will have it".</p> <p>As you build more objects and have those new objects set their external data to something, and populate your world, then you will have something to work with. Until then, just work with OWNER and skin1.</p> <p>So, try changing that top line in the collision call back from:</p> <div class="code"> <pre> <code> if (skin1.Owner == null || skin1.Owner.ExternalData == null) return true;</code> </pre></div> <p>to:</p> <div class="code"> <pre> <code> if (skin1.Owner == null) return true;</code> </pre></div> <p>So don't be set back because the External Data is null. It's basically an empty field that JigLibX creator put in to add extra data to the collision skins. That's why it's of type OBJECT.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-640353</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-640353</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 15:24:38 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>i Did manage to fix this problem, and it turns out that it was the body.SetBodyInvInertia</p> <p>i was using an old version of jiglibx which did not support it.</p> <p>as for the Physics physics = Engine.Services.GetService&lt;Physics&gt;();</p> <p>its there so that i can turn off the physics engine later in that update method. i wont be leaving it there as i know its not a good idea to be calling this every update. Im rushed for time at the moment. as i have a deadline to complete this by so ive taken a game engine ive been working on and ripping bits to finsih this project, which is making for some very messy and untidy code.</p> <p>Thanks alot for the advice and im gonna look into how i can use singleton's as i do wish to port the engine to the XBox at a later date and effeiceny is very important to me.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-640308</guid>
				<title>Re: Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-640308</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 14:09:23 +0000</pubDate>
				<wikidot:authorName>Helpplz</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Thank you very much for taking the time to Post that example. It really did help and ive made some progress. but still stuck im affraid. my skin1.owner.externaldata always seems to be nulll and im not sure if that is what is causing the problem, while debugging i can see that the collision call back class is being called when i move the character into the box but it seems to skip the rest as external data is null. Am i surpose to be settting this sumwhere.</p> <p>Here is my base class physics object class:</p> <div class="code"> <pre> <code>using JigLibX.Collision; using JigLibX.Geometry; using JigLibX.Physics; using Microsoft.Xna.Framework; namespace qkGames { // Provides a base object type for physics simulation public abstract class PhysicsObject : Component { // Local copy of the mass of the object float mass = 1; // The Body managed by the PhysicsObject public Body Body; // The CollisionSkin managed by the PhysicsObject public CollisionSkin CollisionSkin; // The mass of the PhysicsObject public float Mass { get { return mass; } set { // Set the new value mass = value; // Fix transforms Vector3 com = SetMass(value); if (CollisionSkin != null) CollisionSkin.ApplyLocalTransform( new JigLibX.Math.Transform(-com, Matrix.Identity)); } } // The PhysicsObject's position public Vector3 Position { get { return Body.Position; } set { Body.MoveTo(value, Body.Orientation); } } // The PhysicsObject's orientation public Matrix Rotation { get { return Body.Orientation; } set { Body.MoveTo(Body.Position, value); } } // The PhysicsObject's rotation as a Euler Vector public Vector3 EulerRotation { get { return MathUtil.MatrixToVector3(Rotation); } set { Rotation = MathUtil.Vector3ToMatrix(value); } } // Whether or not the physics object is locked in place public bool Immovable { get { return Body.Immovable; } set { Body.Immovable = value; } } // Returns the PhysicsObject's BoundingBox public BoundingBox BoundingBox { get { if (Body.CollisionSkin != null) return Body.CollisionSkin.WorldBoundingBox; else return new BoundingBox(Position - Vector3.One, Position + Vector3.One); } } // The body's velocity public Vector3 Velocity { get { return Body.Velocity; } set { Body.Velocity = value; } } // Constructors public PhysicsObject() : base() { //Body.CollisionSkin.callbackFn += new CollisionCallbackFn(CollisionCallBack); } public PhysicsObject(GameScreen Parent) : base(Parent) { } // Sets up the body and collision skin protected void InitializeBody() { Body = new Body(); CollisionSkin = new CollisionSkin(Body); Body.CollisionSkin = this.CollisionSkin; Body.EnableBody(); } // Sets the mass of the PhysicsObject public Vector3 SetMass(float mass) { PrimitiveProperties primitiveProperties = new PrimitiveProperties( PrimitiveProperties.MassDistributionEnum.Solid, PrimitiveProperties.MassTypeEnum.Density, mass); float junk; Vector3 com; Matrix it, itCoM; CollisionSkin.GetMassProperties(primitiveProperties, out junk, out com, out it, out itCoM); Body.BodyInertia = itCoM; Body.Mass = junk; return com; } // Rotates and moves the model relative to the physics object to // better align the model with the object public void OffsetModel(Vector3 PositionOffset, Matrix RotationOffset) { CollisionSkin.ApplyLocalTransform( new JigLibX.Math.Transform(PositionOffset, RotationOffset)); } // Disables physics body and component public override void DisableComponent() { Body.DisableBody(); base.DisableComponent(); } } }</code> </pre></div> <p>and here is my charachter class</p> <div class="code"> <pre> <code>//**************************CharacterObject*********************************** using JigLibX.Collision; using JigLibX.Geometry; using JigLibX.Physics; using Microsoft.Xna.Framework; using JigLibX.Math; namespace qkGames { public class CharacterObject : PhysicsObject { public virtual bool CollisionCallBack(CollisionSkin skin0, CollisionSkin skin1) { if (skin1.Owner == null || skin1.Owner.ExternalData == null) return true; // if you wanted to know the position of the box you collided with.... Vector3 otherBoxesPosition = skin1.Owner.Position; // xxxxxxxxxxxxxxxxxxxxxxxx // Using a little reflection, we can see exactly what kind of object we collided with. // WARNING: No Guarantee that the members 'ExternalData' or even 'Owner' won't be null if (skin1.Owner.ExternalData is BoxObject) { // i collided with another instance of my type of object PauseScreen pause = new PauseScreen("Pause"); return false; // allow this object to pass through } // if you inherit from this class, and set the 'body.ExternalData' to the gameComponent instance // you can kill that instance when you collide with it.... if (skin1.Owner.ExternalData is GameComponent) ((GameComponent)skin1.Owner.ExternalData).Enabled = false; if (skin1.Owner.ExternalData is DrawableGameComponent) ((DrawableGameComponent)skin1.Owner.ExternalData).Visible = false; // for everything else, we still want the collision handled by the physics engine after our logic // so we return true return false; } public Character CharacterBody { get; set; } CollisionCallbackFn col; public CharacterObject(Vector3 position) : base() { InitializeBody(); Body = new Character(); Vector3 Posi = position; //collision = new CollisionSkin(Body); Body.ExternalData = this; CollisionSkin = new CollisionSkin(Body); Body.CollisionSkin = this.CollisionSkin; //col = new CollisionCallbackFn(CollisionCheck); //Body.CollisionSkin.callbackFn += col; Capsule capsule = new Capsule(Vector3.Zero, Matrix.CreateRotationX(MathHelper.PiOver2), 1.0f, 1.0f); //Body.CollisionSkin.callbackFn += new CollisionCallbackFn(CollisionCallBack); CollisionSkin.AddPrimitive(capsule, new MaterialProperties(0.0f, 0.5f, 0.3f)); //body.CollisionSkin = this.collision; Vector3 com = SetMass(1.0f); Body.MoveTo(position + com, Matrix.Identity); CollisionSkin.ApplyLocalTransform(new Transform(-com, Matrix.Identity)); Body.SetBodyInvInertia(0.0f, 0.0f, 0.0f); CharacterBody = Body as Character; Body.AllowFreezing = false; Body.EnableBody(); Body.CollisionSkin.callbackFn += new CollisionCallbackFn(CollisionCallBack); } } class ASkinPredicate : CollisionSkinPredicate1 { public override bool ConsiderSkin(CollisionSkin skin0) { if (!(skin0.Owner is Character)) return true; else return false; } } public class Character : Body { public Character() : base() { } public Vector3 DesiredVelocity { get; set; } private bool doJump = false; public void DoJump() { doJump = true; } public override void AddExternalForces(float dt) { ClearForces(); if (doJump) { foreach (CollisionInfo info in CollisionSkin.Collisions) { Vector3 N = info.DirToBody0; if (this == info.SkinInfo.Skin1.Owner) Vector3.Negate(ref N, out N); if (Vector3.Dot(N, Orientation.Up) &gt; 0.7f) { Vector3 vel = Velocity; vel.Y = 5.0f; Velocity = vel; break; } } } Vector3 deltaVel = DesiredVelocity - Velocity; bool running = true; if (DesiredVelocity.LengthSquared() &lt; JiggleMath.Epsilon) running = false; else deltaVel.Normalize(); deltaVel.Y = 0.0f; // start fast, slow down slower if (running) deltaVel *= 10.0f; else deltaVel *= 2.0f; float forceFactor = 1000.0f; AddBodyForce(deltaVel * Mass * dt * forceFactor); doJump = false; AddGravityToExternalForce(); } //bool CollisionCheck(CollisionSkin skin0, CollisionSkin skin1) // { // return true; //} } }</code> </pre></div> <p>And here is my box object</p> <div class="code"> <pre> <code>using JigLibX.Collision; using JigLibX.Geometry; using JigLibX.Physics; using Microsoft.Xna.Framework; namespace qkGames { public class BoxObject : PhysicsObject { Vector3 sideLengths; // teh length of the sides of the box public Vector3 SideLengths { get { return sideLengths; } set { // Set the new value sideLengths = value; // Update the collision skin CollisionSkin.RemoveAllPrimitives(); CollisionSkin.AddPrimitive( new Box(-0.5f * value, Body.Orientation, value), new MaterialProperties(0.8f, 0.8f, 0.7f)); // Set the mass to itself to fix the local transform // on the CollisionSkin in the set accessor this.Mass = this.Mass; } } //contructors public BoxObject() : base() { InitializeBody(); SideLengths = Vector3.One; } public BoxObject(Vector3 SideLengths) :base() { SetupSkin(SideLengths, Vector3.Zero, Vector3.Zero); } public BoxObject(Vector3 SideLengths, Vector3 Position, Vector3 Rotation) : base() { SetupSkin(SideLengths, Position, Rotation); } public BoxObject(Vector3 SideLengths, Vector3 Position, Vector3 Rotation, GameScreen Parent) : base(Parent) { SetupSkin(SideLengths, Position, Rotation); } //setup object with parameters void SetupSkin(Vector3 SideLengths, Vector3 Position, Vector3 Rotation) { //setup body InitializeBody(); //Set Properties this.SideLengths = SideLengths; this.Position = Position; this.EulerRotation = Rotation; } } }</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-640104</guid>
				<title>Re: Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-640104</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 05:58:44 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>To take it a step further, lets say we want 3 types of boxes….</p> <p><strong>The Floor :</strong> We don't need anything special if we collide with floor, just regular physics. Also, the floor should not move</p> <p><strong>GoodGuy Boxes:</strong> If GoodGuys crash into other GoodGuys, nothing bad happens</p> <p><strong>BadGuyBoxes :</strong> If a BadGuy crashes into a GoodGuy, the bad guy calls the 'Destroy' method on the 'GoodGuy'.</p> <p>So i can do that with very little code if i inherit from the class above.</p> <p>Special note, i would have to modify the member 'body' to be protected instead of private…….</p> <div class="code"> <pre> <code> // this class inherits from CollidableObject and simply builds a flat floor plane, 100 X 100, and only 3 units high. // also, i had to add the 'protected' modifier to the 'body' member, so i could get to it in this class public class Floor : CollidableObject { public Floor(Game game) : base(game, Vector3.Zero, Quaternion.Identity, new Vector3(100, 3, 100)) { this.body.Immovable = true; } } // this class inherits from CollidableObject and overrides the CollisionCallBack public class GoodGuyBox : CollidableObject { public GoodGuyBox(Game game, Vector3 pos, Quaternion rot, Vector3 scl) : base(game, pos, rot, scl) { } public override bool CollisionCallBack(CollisionSkin skin0, CollisionSkin skin1) { if (skin1.Owner.ExternalData is GoodGuyBox) { // it's ok to collide with other good guys, return true; } return base.CollisionCallBack(skin0, skin1); } } // this class inherits from CollidableObject and overrides the CollisionCallBack public class BadGuyBox : CollidableObject { public BadGuyBox(Game game, Vector3 pos, Quaternion rot, Vector3 scl) : base(game, pos, rot, scl) { } public override bool CollisionCallBack(CollisionSkin skin0, CollisionSkin skin1) { if (skin1.Owner.ExternalData is GoodGuyBox) { // since this instance is a 'bad guy' he deactivates 'Good Guys' when it collides with them ((GoodGuyBox)skin1.Owner.ExternalData).Destroy(); return true; } return base.CollisionCallBack(skin0, skin1); } }</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-640094</guid>
				<title>Re: Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-640094</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 05:29:56 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Ok, here is a class</p> <p>It's a simple template for a physics object that would fall from where ever you place it, and collide<br /> with whatever else is in the world, if you instantiate a few of these. It also draws a model and keeps the model's position synched with the BODY.</p> <p>As you see, the class simply inherits from DrawableGameComponent. Update and Draw are not needed for the physics to work, as long as in your main game, you are updating the actual physics engine. I just use update to keep the model's position synched with the BODY, and Draw to draw the model only.</p> <p>Also, this shows that i am not inheriting from any other objects in the physics library. I'm simply using a couple of members: Body, Skin, and that's all you really need.</p> <p>To know how to catch the event when collsion occurs, look at how i subscribe to the object's own collision event :</p> <p>body.CollisionSkin.callbackFn += new CollisionCallbackFn(CollisionCallBack);</p> <p>Look at my comments and examples in there for more…..</p> <p>In the CollisionCallBack:<br /> - return 'true' if you want the collision to be considered, and 'false' if you want it to be ignored (walk through an item).</p> <p>There is actually more to know with what you can do in those methods, but i'll let other people on the forum add to it, or i will later.</p> <div class="code"> <pre> <code> public class CollidableObject : DrawableGameComponent { #region Constructor / Init / Load public CollidableObject(Game game, Vector3 pos, Quaternion rot, Vector3 scl) : base(game) { body = new Body(); // this makes it possible to get back up to this object, when you detect a collision from an event body.ExternalData = this; _materialProperties = new MaterialProperties(0.0001f, 0.5f, 0.5f); this.position = pos; this.scale = scl; this.rotation = Matrix.CreateFromQuaternion(rot); this._skin = new CollisionSkin(body); body.CollisionSkin = _skin; RebuildSkinPrimitive(scl); com = SetMass(200); body.MoveTo(position, rotation); this._skin.ApplyLocalTransform(new Transform(-com, rotation)); body.EnableBody(); body.CollisionSkin.callbackFn += new CollisionCallbackFn(CollisionCallBack); } protected override void LoadContent() { base.LoadContent(); model = Game.Content.Load&lt;Model&gt;("model/monkeyhead123"); bones = new Matrix[model.Bones.Count]; } #endregion #region Propeties Model model; Vector3 com; Body body; private Matrix[] bones; private Vector3 position; private Vector3 scale; private Matrix rotation; private bool isDestroyed = false; private bool isCleanedUp = false; private CollisionSkin _skin; public CollisionSkin Skin { get { return _skin; } } private MaterialProperties _materialProperties; #endregion #region XNA Overrides public override void Update(GameTime gameTime) { this.position = body.Position; this.rotation = body.Orientation; if (isDestroyed &amp;&amp; !isCleanedUp) Release(); } public override void Draw(GameTime gameTime) { model.CopyAbsoluteBoneTransformsTo(bones); // Render the skinned mesh. foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.View = Global3dGame.CurrentCamera.View; effect.Projection = Global3dGame.CurrentCamera.Projection; effect.World = bones[mesh.ParentBone.Index] * GetWorldMatrix(); effect.EnableDefaultLighting(); effect.GraphicsDevice.RenderState.AlphaBlendEnable = false; effect.GraphicsDevice.RenderState.DepthBufferEnable = true; } mesh.Draw(); } } #endregion #region Methods public virtual bool CollisionCallBack(CollisionSkin skin0, CollisionSkin skin1) { if (skin1.Owner == null || skin1.Owner.ExternalData == null) return true; // if you wanted to know the position of the box you collided with.... Vector3 otherBoxesPosition = skin1.Owner.Position; // xxxxxxxxxxxxxxxxxxxxxxxx // Using a little reflection, we can see exactly what kind of object we collided with. // WARNING: No Guarantee that the members 'ExternalData' or even 'Owner' won't be null if (skin1.Owner.ExternalData is CollidableObject) { // i collided with another instance of my type of object return false; // allow this object to pass through } // if you inherit from this class, and set the 'body.ExternalData' to the gameComponent instance // you can kill that instance when you collide with it.... if (skin1.Owner.ExternalData is GameComponent) ((GameComponent)skin1.Owner.ExternalData).Enabled = false; if (skin1.Owner.ExternalData is DrawableGameComponent) ((DrawableGameComponent)skin1.Owner.ExternalData).Visible = false; // for everything else, we still want the collision handled by the physics engine after our logic // so we return true return true; } public void MoveTo(Vector3 pos, Quaternion rot) { body.MoveTo(pos, Matrix.CreateFromQuaternion(rot)); _skin.ApplyLocalTransform(new Transform(-com, Matrix.CreateFromQuaternion(rot))); } private Vector3 SetMass(float mass) { PrimitiveProperties primitiveProperties = new PrimitiveProperties( PrimitiveProperties.MassDistributionEnum.Solid, PrimitiveProperties.MassTypeEnum.Mass, mass); float junk; Vector3 com; Matrix it; Matrix itCoM; Skin.GetMassProperties(primitiveProperties, out junk, out com, out it, out itCoM); body.BodyInertia = itCoM; body.Mass = junk; return com; } private void RebuildSkinPrimitive(Vector3 newScale) { this._skin.RemoveAllPrimitives(); Box box = new Box(-(newScale * 0.5f), Matrix.Identity, newScale); _skin.AddPrimitive(box, _materialProperties); } public void SetScale(Vector3 newScale) { this.scale = newScale; RebuildSkinPrimitive(scale); } private Matrix GetWorldMatrix() { return Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position); } public void Destroy() { isDestroyed = true; } private void Release() { this.body.DisableBody(); isCleanedUp = true; this.Enabled = false; this.Visible = false; } #endregion }</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-199172#post-639893</guid>
				<title>Catching Collision events</title>
				<link>http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events#post-639893</link>
				<description></description>
				<pubDate>Mon, 23 Nov 2009 00:00:42 +0000</pubDate>
				<wikidot:authorName>Helpplz</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi.</p> <p>Is there anyone who can give an actuall example of catching collision events pls. ive looked at both the tutorial and fourm, but it seems they both assume i know more than i do.i half understand the code but Im unsure where to be putting each bit of code. and wat to be changing in each part :/</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-199172/catching-collision-events">Catching Collision events</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-639869</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-639869</link>
				<description></description>
				<pubDate>Sun, 22 Nov 2009 23:30:37 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Also, I noticed you have quite a lot of allocations and you create a lot of scope level variables.</p> <p>.NET on XBOX sucks, so for that kind of stuff (garbage collection), create a class level field, and keep reassigning. It's not the best OOP, but for XBOX, you need optimize for that kind of stuff.</p> <p>Also, maybe i'm wrong, but i prefer a singletons for my common engine hooks to using that service pattern.</p> <p>1. Constantly casting the same objects over and over can be costly.</p> <p>2. A method call costs more than accessing a singleton.</p> <p>3. Reflection is Expensive. You should get a handle on it at Init, and hold on to it, instead of using Expensive REFLECTION, in every update. Doing it update is only useful if you plan on swapping the whole physics implementation during gameplay.</p> <p>I really shouldn't talk because i'm not a game developer, as much as a general software person, and i'm wrong a lot.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-639857</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-639857</link>
				<description></description>
				<pubDate>Sun, 22 Nov 2009 23:08:41 +0000</pubDate>
				<wikidot:authorName>MikeTsouris</wikidot:authorName>				<wikidot:authorUserId>392363</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hey,</p> <p>i had the same problem when i was starting out with jigLibX. With me, i would be able to move around for a few seconds, then my character would start spinning, then orbiting, the fly off. I don't remember exactly what the issue was, because it was a few months ago.</p> <p>I do have some suggestions. You should try all of these at least once, and see what effect it has on the controllability of your character when dealing with bumpy terrain.</p> <p>For me, i used a combination of making my character much smaller, finely tuning the speed at which it moves, restricting possible rotation, and adjusting MaterialProperties.</p> <p>I don't think it's an issue of the hieghtMap object. However, make sure the heightMap object is NOT internally setting some SMOOTH or BOUNCY MaterialProperty. If it is, change the property type to something ROUGH and NOT BOUNCY</p> <p>So check these……..</p> <p>1. What are the MaterialProperties you are giving to the HeightMap object?</p> <p>2. What are the MaterialProperties you are giving to the character?</p> <p>3. Are you manually setting body.Orientation of your character anywhere? If you are, don't.</p> <p>4. How big is your sphere or capsule that you are using as your character on your height map? Try making it 10 times smaller. Try making it 10 times bigger. Do any of those help calm down the out of control spinning?</p> <p>**<br /> 5. On each update cycle, before you start calculating your movement stuff, try setting your body.DesiredVelicity = Vector.Zero;. Then, if there is any movement you add from I personally do that so that when i am not touching my controller, my character does not move. Since my game is not about people on ice, this works just fine for me. Be setting it back to Zero, you are ensuring that it is not accumulating value from any other weirdness you might have in your code.<br /> *</p> <p>6. Try only applying rotation on the Y axis ONLY. So, basically, it's like saying that your character can only turn right and left. Now, since your game is First Person Camera, you can still apply the Pitch rotation to the camera, just don't apply it to the character. This might not be what you want in your final game, but it's worth trying to see if it solves the 'spinning out of control' problem.<br /> So mine looks like this:</p> <p>Rotation *= Matrix.CreateRotationY(changeRotationY * 0.1f);</p> <p>Regarding MaterialProperties: You assign MaterialProperties when you add a primitive to a collision skin, so if i add a sphere it looks like this….</p> <p>collision.AddPrimitive(sphere, MaterialId)</p> <p>And if you want to know what the possible material Id's are:</p> <p>// MaterialTable<br /> //Unset = 0,<br /> //UserDefined = 1,<br /> //NotBouncySmooth = 2,<br /> //NotBouncyNormal = 3,<br /> //NotBouncyRough = 4,<br /> //NormalSmooth = 5,<br /> //NormalNormal = 6,<br /> //NormalRough = 7,<br /> //BouncySmooth = 8,<br /> //BouncyNormal = 9,<br /> //BouncyRough = 10,<br /> //NumMaterialTypes = 11,</p> <p>Try picking a Material that is not smooth or bouncy at all. MaterialProperies have a huge impact of how controllable something will be in the physics system.</p> <p>Also try setting your mass to 500.</p> <p>Also, i don't know why you are executing in your Update:</p> <p>Physics physics = Engine.Services.GetService&lt;Physics&gt;();</p> <p>What else are you doing in that whacky Update method of yours?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-638455</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-638455</link>
				<description></description>
				<pubDate>Fri, 20 Nov 2009 19:07:33 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>ah, the reason i have that commented out is cause my jiblibx dosnt support it, cant get a complited version of the latest.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-637906</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-637906</link>
				<description></description>
				<pubDate>Fri, 20 Nov 2009 00:43:24 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>anyone can upload the latest jiglibx with heightmapinfo included?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-637904</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-637904</link>
				<description></description>
				<pubDate>Fri, 20 Nov 2009 00:42:35 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Affraid i had no luck with that, tried commenting it out but it still behaves in the same way.</p> <p>anymore suggestions</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-637384</guid>
				<title>Re: NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-637384</link>
				<description></description>
				<pubDate>Thu, 19 Nov 2009 13:12:39 +0000</pubDate>
				<wikidot:authorName>Thiago</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>OK, i will, but can you post all the code that make your character move when/if you are done</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-637313</guid>
				<title>Re: NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-637313</link>
				<description></description>
				<pubDate>Thu, 19 Nov 2009 09:59:53 +0000</pubDate>
				<wikidot:authorName>vandop</wikidot:authorName>				<wikidot:authorUserId>400128</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I'll check jiglib code's soon. If I solve it, i'll post it here the solution. Do the same if you solve it:D</p> <p>Thanks</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-635037</guid>
				<title>Re: NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-635037</link>
				<description></description>
				<pubDate>Mon, 16 Nov 2009 19:13:02 +0000</pubDate>
				<wikidot:authorName>Thiago</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>i have exactely the SAME problem. If you solve your problem pls Post here<br /> vandop, Can you post all your code, maybe you can help me ?<br /> if you prefer mail me <span class="wiki-email">moc.liamg|rotsapsaidogaiht#moc.liamg|rotsapsaidogaiht</span></p> <p>thank you</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-634126</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-634126</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 22:08:50 +0000</pubDate>
				<wikidot:authorName>BlackSpiderWolf</wikidot:authorName>				<wikidot:authorUserId>278540</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I've got a character which is pretty much the same as yours.<br /> So I've just copy and pasted some of your code. (CharacterObject,CharacterBody)</p> <p>I found the problem to be<br /> //Body.SetBodyInvInertia(0.0f, 0.0f, 0.0f);<br /> This shouldn't be commented out, once I uncommented it everything work fine.</p> <p>If this doesn't work I'm more then happy to post some of my code.<br /> Hope this helps.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-197093#post-633895</guid>
				<title>Limit orientation constraint</title>
				<link>http://jiglibx.wikidot.com/forum/t-197093/limit-orientation-constraint#post-633895</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 17:31:55 +0000</pubDate>
				<wikidot:authorName>Camal</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>I try to write a constraint which limits orientation of a body. (spherical joint)<br /> For example, i want to limit orientation from (-30, -30, 0) to (+30,+30, 0).</p> <p>I have tried to use two hinge joints (X axis and Y axis) but the<br /> result seems unstable.<br /> I have tried to compute axis angle from orientation matrix, in order<br /> to deduce torque to apply. The results seems unstable too.</p> <p>Any idea?</p> <p>Thank you</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-197093/limit-orientation-constraint">Limit orientation constraint</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-633697</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-633697</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 12:17:30 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Does anyone have a complied version of 0.3.1 with the heightmapinfo.cs included. when i try the one from the main site i get errors.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-633696</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-633696</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 12:16:35 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>If i use a Box as a Physics Object and drop it anywhere on the map it dosnt seem to have any problems, which leads me to belive my highetmap info is fine. it will roll and bounce correctly. the problem seems to be related to the charachter controller and the forces im applying to it i think.</p> <p>Not to sure what you mean by not modifying the hightmap pipeline</p> <p>THanks alot for the reply, all help is appreciated.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-633632</guid>
				<title>Re: NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-633632</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 09:30:18 +0000</pubDate>
				<wikidot:authorName>vandop</wikidot:authorName>				<wikidot:authorUserId>400128</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks for the fast answer:D</p> <p>I've made some tests, with this:</p> <div class="code"> <pre> <code>float clamped = MathHelper.Clamp(rotationAngle, MathHelper.Pi, MathHelper.TwoPi); runPlayer.CharacterBody.SetOrientation(Matrix.CreateRotationY(clamped));</code> </pre></div> <p>And in the first 0.3 rads, its ok, but when angle gets angles &gt; 0.3 i got a NaN.</p> <p>I've already tried MoveTo, but passing body.Position, it didn't moved. I've looked to jigLibX code and Velocity and forces are reseted:\ But the rotation works well.</p> <p>If you need more code, I can post, but rotationAngle is a simple float imcremented with thumbsticks. I'm clamping it for test purpose, but none of clamps that i've tried has worked.</p> <p>Sorry about english.</p> <p>Thanks</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-633583</guid>
				<title>Re: Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-633583</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 06:52:00 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>i'm not really sure what would cause this. but i have a few questions that can maybe diagnose the problem.</p> <p>have you tried other physic objects (besides the heightmap and character) on the heightmap?</p> <p>what are you using for integrate. is it a fixed timestep?</p> <p>also just wanted to say its cool you use the services you obviously know what your doing. also why did you decide to not use / modify the hightmap pipeline?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-633575</guid>
				<title>Re: NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-633575</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 06:40:58 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>can you post the code?</p> <p>make sure the matrix has no scale or translations applied to it.</p> <p>if your positive the matrix is okay then you might want to try using MoveTo instead. passing in the body.position for the first parameter. i cant remember if this will clear the bodies velocity/torque/force or not however.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196134#post-633570</guid>
				<title>Re: how to move objects?</title>
				<link>http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects#post-633570</link>
				<description></description>
				<pubDate>Sun, 15 Nov 2009 06:35:32 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>well it doesnt just teleport. it also wakes up anything resting against it.</p> <p>if your trying to apply a velocity you might want to make your own body class heres a example based on character body</p> <div class="code"> <pre> <code>public class DesiredVelocityBody : Body { public Vector3 desiredVelocity; public override void AddExternalForces(float dt) { ClearForces(); Vector3 deltaVel = desiredVelocity - Velocity; bool running = true; if (desiredVelocity.LengthSquared() &lt; JigLibX.Math.JiggleMath.Epsilon) running = false; else deltaVel.Normalize(); deltaVel.Y = 0.0f; // start fast, slow down slower if (running) deltaVel *= 10.0f; else deltaVel *= 2.0f; float forceFactor = 1000.0f; AddBodyForce(deltaVel * Mass * dt * forceFactor); AddGravityToExternalForce(); } }</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects">how to move objects?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196861#post-633145</guid>
				<title>NaN when trying to rotate my character</title>
				<link>http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character#post-633145</link>
				<description></description>
				<pubDate>Sat, 14 Nov 2009 18:18:30 +0000</pubDate>
				<wikidot:authorName>vandop</wikidot:authorName>				<wikidot:authorUserId>400128</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi!!!</p> <p>I'm trying to rotate my Character, using SetOrientation. But when I do that, my character disappears and in debug I can see that his position is NaN:|</p> <p>Some suggestion?</p> <p>Thanks</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196861/nan-when-trying-to-rotate-my-character">NaN when trying to rotate my character</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196817#post-633099</guid>
				<title>Charchter controller flying off</title>
				<link>http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off#post-633099</link>
				<description></description>
				<pubDate>Sat, 14 Nov 2009 17:00:15 +0000</pubDate>
				<wikidot:authorName>Ricsh</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi, my charcter controller wont seem to work no matter what i do, it will fly off in to the sky doing circles when i go on uneven terrain. it seems a bit more stable on flat terrain.</p> <p>heres some of my code</p> <p>Charatcher controller.</p> <div class="code"> <pre> <code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using qkGames; using JigLibX.Physics; using Microsoft.Xna.Framework; using JigLibX.Collision; using Microsoft.Xna.Framework.Graphics; using JigLibX.Geometry; using JigLibX.Math; using Microsoft.Xna.Framework.Input; namespace qkGames { class CharacterObject : PhysicsObject { public Character CharacterBody {get; set;} public CharacterObject(Vector3 position) : base() { Body = new Character(); CollisionSkin = new CollisionSkin(Body); //public Vector3 DesiredVelocity { get; set; } Capsule capsule = new Capsule(Vector3.Zero, Matrix.CreateRotationX(MathHelper.PiOver2), 1.0f, 1.0f); CollisionSkin.AddPrimitive(capsule, (int)MaterialTable.MaterialID.NotBouncyNormal, new MaterialProperties(0.0f, 0.0f, 0.0f)); Body.CollisionSkin = this.CollisionSkin; Vector3 com = SetMass(1.0f); Body.MoveTo(position + com, Matrix.Identity); CollisionSkin.ApplyLocalTransform(new Transform(-com, Matrix.Identity)); //Body.BodyInertia(0.0f, 0.0f, 0.0f); //Body.SetBodyInvInertia(0.0f, 0.0f, 0.0f); CharacterBody = Body as Character; Body.AllowFreezing = false; Body.EnableBody(); } // public override void ApplyEffects(BasicEffect effect) //{ //throw new NotImplementedException(); //} } class ASkinPredicate : CollisionSkinPredicate1 { public override bool ConsiderSkin(CollisionSkin skin0) { if (!(skin0.Owner is Character)) return true; else return false; } } class Character : Body { public Character() : base() { } public Vector3 DesiredVelocity { get; set; } private bool doJump = false; public void DoJump() { doJump = true; } public override void AddExternalForces(float dt) { ClearForces(); if (doJump) { foreach (CollisionInfo info in CollisionSkin.Collisions) { Vector3 N = info.DirToBody0; if (this == info.SkinInfo.Skin1.Owner) Vector3.Negate(ref N, out N); if (Vector3.Dot(N, Orientation.Up) &gt; 0.7f) { Vector3 vel = Velocity; vel.Y = 5.0f; Velocity = vel; break; } } } Vector3 deltaVel = DesiredVelocity - Velocity; bool running = true; if (DesiredVelocity.LengthSquared() &lt; JiggleMath.Epsilon) running = false; else deltaVel.Normalize(); deltaVel.Y = 0.0f; // start fast, slow down slower if (running) deltaVel *= 10.0f; else deltaVel *= 2.0f; float forceFactor = 1000.0f; AddBodyForce(deltaVel * Mass * dt * forceFactor); doJump = false; AddGravityToExternalForce(); } } }</code> </pre></div> <p>And heres my terrain class</p> <div class="code"> <pre> <code>using System; using JigLibX.Geometry; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace qkGames { public class Terrain : Component, I3DComponent { // Height representation public float[,] heightData; // Physics height representation HeightMapInfo heightMapInfo; // Physics object HeightMapObject heightMapObject; // Terrain texture // Texture2D texture; public TerrainMaterial Material; // Vertex and index buffers VertexDeclaration myVertexDeclaration; VertexBuffer terrainVertexBuffer; IndexBuffer terrainIndexBuffer; // Effect BasicEffect basicEffect; // I3DComponent values Vector3 position = Vector3.Zero; Matrix rotation = Matrix.Identity; Vector3 scale = new Vector3(1, 1, -1); BoundingBox boundingBox = new BoundingBox(new Vector3(-1), new Vector3(1)); public Vector3 Position { get { return position; } set { position = value; } } public Vector3 EulerRotation { get { return MathUtil.MatrixToVector3(Rotation); } set { this.Rotation = MathUtil.Vector3ToMatrix(value); } } public Matrix Rotation { get { return rotation; } set { rotation = value; } } public Vector3 Scale { get { return scale; } set { scale = value; } } public BoundingBox BoundingBox { get { return boundingBox; } } // Constructors public Terrain(Texture2D HeightMap, Texture2D Texture) : base() { Setup(HeightMap, Texture); } public Terrain(Texture2D HeightMap, Texture2D Texture, GameScreen Parent) : base(Parent) { Setup(HeightMap, Texture); } void Setup(Texture2D Heightmap, Texture2D Texture) { // Load height data heightData = CreateTerrain(Heightmap); // Create vertex and index buffers myVertexDeclaration = new VertexDeclaration(Engine.GraphicsDevice, VertexPositionNormalTexture.VertexElements); VertexPositionNormalTexture[] terrainVertices = CreateVertices(); int[] terrainIndices = CreateIndices(); terrainVertices = GenerateNormalsForTriangleStrip(terrainVertices, terrainIndices); CreateBuffers(terrainVertices, terrainIndices); // Setup effect Material = new TerrainMaterial(Texture); } // Sets up terrain, texture, etc private float[,] CreateTerrain(Texture2D heightMap) { // Minimum and maximum heights for terrain float minimumHeight = 0; float maximumHeight = 255; // Width and height of terrain (from heightmap) int width = heightMap.Width; int height = heightMap.Height; // Setup bounding box with width and height boundingBox = new BoundingBox( new Vector3(-width / 2, maximumHeight - minimumHeight, -height / 2), new Vector3(width / 2, maximumHeight - minimumHeight, height / 2)); // Get data from heightmap Color[] heightMapColors = new Color[width * height]; heightMap.GetData&lt;Color&gt;(heightMapColors); // Setup height data from heightmap data float[,] heightData = new float[width, height]; for (int x = 0; x &lt; width; x++) for (int y = 0; y &lt; height; y++) { heightData[x, y] = heightMapColors[x + y * width].R; if (heightData[x, y] &lt; minimumHeight) minimumHeight = heightData[x, y]; if (heightData[x, y] &gt; maximumHeight) maximumHeight = heightData[x, y]; } for (int x = 0; x &lt; width; x++) for (int y = 0; y &lt; height; y++) heightData[x, y] = (heightData[x, y] - minimumHeight) / (maximumHeight - minimumHeight) * 30.0f; // Setup physics heightMapInfo = new HeightMapInfo(heightData, 1); if (heightMapObject != null) { heightMapObject.DisableComponent(); heightMapObject = null; } heightMapObject = new HeightMapObject(heightMapInfo, new Vector2( heightMapInfo.Width / 2, -heightMapInfo.Height / 2 + heightMapInfo.Height)); return heightData; } // Set up vertices private VertexPositionNormalTexture[] CreateVertices() { // Get width and height and create new vertex array int width = heightData.GetLength(0); int height = heightData.GetLength(1); VertexPositionNormalTexture[] terrainVertices = new VertexPositionNormalTexture[width * height]; // Calculate position, normal, and texcoords for vertices int i = 0; for (int z = 0; z &lt; height; z++) for (int x = 0; x &lt; width; x++) { Vector3 position = new Vector3(x, heightData[x, z], -z); Vector3 normal = new Vector3(0, 0, 1); Vector2 texCoord = new Vector2((float)x / 30.0f, (float)z / 30.0f); terrainVertices[i++] = new VertexPositionNormalTexture( position, normal, texCoord); } return terrainVertices; } // Set up indices private int[] CreateIndices() { // Get width and height and create new index array int width = heightData.GetLength(0); int height = heightData.GetLength(1); int[] terrainIndices = new int[(width) * 2 * (height - 1)]; // Calculate indices for triangle int i = 0; int z = 0; while (z &lt; height - 1) { for (int x = 0; x &lt; width; x++) { terrainIndices[i++] = x + z * width; terrainIndices[i++] = x + (z + 1) * width; } z++; if (z &lt; height - 1) { for (int x = width - 1; x &gt;= 0; x--) { terrainIndices[i++] = x + (z + 1) * width; terrainIndices[i++] = x + z * width; } } z++; } return terrainIndices; } // Generates normals for a group of triangles private VertexPositionNormalTexture[] GenerateNormalsForTriangleStrip( VertexPositionNormalTexture[] vertices, int[] indices) { for (int i = 0; i &lt; vertices.Length; i++) vertices[i].Normal = new Vector3(0, 0, 0); bool swappedWinding = false; for (int i = 2; i &lt; indices.Length; i++) { Vector3 firstVec = vertices[indices[i - 1]].Position - vertices[indices[i]].Position; Vector3 secondVec = vertices[indices[i - 2]].Position - vertices[indices[i]].Position; Vector3 normal = Vector3.Cross(firstVec, secondVec); normal.Normalize(); if (swappedWinding) normal *= -1; if (!float.IsNaN(normal.X)) { vertices[indices[i]].Normal += normal; vertices[indices[i - 1]].Normal += normal; vertices[indices[i - 2]].Normal += normal; } swappedWinding = !swappedWinding; } for (int i = 0; i &lt; vertices.Length; i++) vertices[i].Normal.Normalize(); return vertices; } // Sets up vertex and index buffers used for drawing private void CreateBuffers(VertexPositionNormalTexture[] vertices, int[] indices) { terrainVertexBuffer = new VertexBuffer(Engine.GraphicsDevice, VertexPositionNormalTexture.SizeInBytes * vertices.Length, BufferUsage.WriteOnly); terrainVertexBuffer.SetData(vertices); terrainIndexBuffer = new IndexBuffer(Engine.GraphicsDevice, typeof(int), indices.Length, BufferUsage.WriteOnly); terrainIndexBuffer.SetData(indices); } // Draw the terrain public override void Draw() { // Require the camera Camera camera = Engine.Services.GetService&lt;Camera&gt;(); if (camera == null) throw new Exception("The engine services does not contain a " + "camera service. The terrain requires a camera to draw."); // Set effect values Material.Prepare3DDraw(MathUtil.CreateWorldMatrix(position, rotation, scale)); // Get width and height int width = heightData.GetLength(0); int height = heightData.GetLength(1); // Terrain uses different vertex winding than normal models, //so set the new one Engine.GraphicsDevice.RenderState.CullMode = CullMode.CullClockwiseFace; // Start the effect Material.Effect.Begin(); // For each pass.. foreach (EffectPass pass in Material.Effect.CurrentTechnique.Passes) { // Begin the pass pass.Begin(); // Draw the terrain vertices and indices Engine.GraphicsDevice.Vertices[0].SetSource(terrainVertexBuffer, 0, VertexPositionNormalTexture.SizeInBytes); Engine.GraphicsDevice.Indices = terrainIndexBuffer; Engine.GraphicsDevice.VertexDeclaration = myVertexDeclaration; Engine.GraphicsDevice.DrawIndexedPrimitives( Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleStrip, 0, 0, width * height, 0, width * 2 * (height - 1) - 2); // End the pass pass.End(); } // End the effect Material.Effect.End(); // Set the vertex winding back Engine.GraphicsDevice.RenderState.CullMode = CullMode.CullCounterClockwiseFace; } } }</code> </pre></div> <p>And the update method of my main game</p> <div class="code"> <pre> <code>public override void Update() { //physics.UpdatePhysics = true; KeyboardDevice keyboard = Engine.Services.GetService&lt;KeyboardDevice&gt;(); MouseDevice mouse = Engine.Services.GetService&lt;MouseDevice&gt;(); Camera cam = (Camera)Engine.Services.GetService&lt;Camera&gt;(); Physics physics = Engine.Services.GetService&lt;Physics&gt;(); // Vector3 inputModifier = new Vector3( // (keyboard.IsKeyDown(Keys.A) ? -1 : 0) + (keyboard.IsKeyDown(Keys.D) ? 1 : 0), // (keyboard.IsKeyDown(Keys.Q) ? -1 : 0) + (keyboard.IsKeyDown(Keys.E) ? 1 : 0), // (keyboard.IsKeyDown(Keys.W) ? -1 : 0) + (keyboard.IsKeyDown(Keys.S) ? 1 : 0) // ); //cam.IsMousePinned = true; //cam.EnableKeyboardInput = false; cam.Position = character.Body.Position + Vector3.Up; //this.IsMouseVisible = false; Vector3 moveVector = new Vector3(); float amountOfMovement = 0.5f; if (keyboard.IsKeyDown(Keys.D)) moveVector += Vector3.Right; //character.Body.MoveTo(moveVector, cameraRotation); if (keyboard.IsKeyDown(Keys.A)) moveVector += Vector3.Left; if (keyboard.IsKeyDown(Keys.S)) moveVector += Vector3.Backward; if (keyboard.IsKeyDown(Keys.W)) moveVector += Vector3.Forward; Matrix cameraRotation = Matrix.CreateRotationX(cam.Angles.X) * Matrix.CreateRotationY(cam.Angles.Y); moveVector = Vector3.Transform(moveVector, cameraRotation); JiggleMath.NormalizeSafe(ref moveVector); moveVector *= amountOfMovement; //character.Body.MoveTo(moveVector, Matrix.Identity); character.CharacterBody.DesiredVelocity = moveVector; if (keyboard.IsKeyDown(Keys.Space)) character.CharacterBody.DoJump(); cam.RotateTranslate(new Vector3(mouse.Delta.Y * -.002f, mouse.Delta.X * -.002f, 0), Vector3.Zero * .05f);</code> </pre></div> <p>and my camera class incase it will help</p> <div class="code"> <pre> <code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; namespace qkGames { public class Camera : Component, I3DComponent { //basic camera class Vector3 rotation; Vector3 translation; //internal values Vector3 position = Vector3.Zero; Matrix rotationMatrix = Matrix.Identity; Vector3 target = new Vector3(0, 0, -1); Vector3 up = Vector3.Up; Matrix view; Matrix projection; private Vector2 angles = Vector2.Zero; //camera look at public Vector2 Angles { get { return angles; } } public virtual Vector3 Target { get { return target; } set { Vector3 forward = Vector3.Normalize(position - value); Vector3 right = Vector3.Normalize(Vector3.Cross(forward, Vector3.Up)); Vector3 up = Vector3.Normalize(Vector3.Cross(right, forward)); Matrix test = Matrix.Identity; test.Forward = forward; test.Right = right; test.Up = up; angles.X = -(float)Math.Asin(test.M32); angles.Y = -(float)Math.Asin(test.M13); target = value; } } // the view and proj matrixes commonly used for renderin public virtual Matrix View { get { return view; } set { view = value; } } public virtual Matrix Projection { get { return projection; } set { projection = value; } } public virtual Vector3 Up { get { return up; } set { up = value; } } public virtual Vector3 Position { get { return position; } set { position = value; } } public virtual Vector3 Scale { get { return Vector3.One; } set { } } public Vector3 EulerRotation { get { return MathUtil.MatrixToVector3(rotationMatrix); } set { rotationMatrix = MathUtil.Vector3ToMatrix(value); } } //the rotation matrix used by camera an up public virtual Matrix Rotation { get { return rotationMatrix; } set { rotationMatrix = value; } } public virtual BoundingBox BoundingBox { get { return new BoundingBox(position - Vector3.One, position + Vector3.One); } } //Constructors public Camera(GameScreen Parent) : base(Parent) { } public Camera() : base() { } //update camera public void RotateTranslate(Vector3 Rotation, Vector3 Trans) { translation += Trans; rotation += Rotation; } public override void Update() { //calc the direction from the postition to the target and normalise Vector3 newForward = Target - position; newForward.Normalize(); //set the rotation matrix and forward to this vector Matrix rotationMatrixCopy = this.Rotation; rotationMatrixCopy.Forward = newForward; //save a copy of up Vector3 referenceVector = Vector3.Up; //incase camera is pointed perfectly on y axis if (rotationMatrixCopy.Forward.Y == referenceVector.Y || rotationMatrixCopy.Forward.Y == -referenceVector.Y) referenceVector = Vector3.Backward; //calc the parts of rotation matrix rotationMatrixCopy.Right = Vector3.Cross(this.Rotation.Forward, referenceVector); rotationMatrixCopy.Up = Vector3.Cross(this.Rotation.Right, this.Rotation.Forward); this.Rotation = rotationMatrixCopy; //use rotation to find new up up = rotationMatrixCopy.Up; //recalc view and proj View = Matrix.CreateLookAt(position, Target, Up); Projection = MathUtil.CreateProjectionMatrix(); } } }</code> </pre></div> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196817/charchter-controller-flying-off">Charchter controller flying off</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196134#post-633079</guid>
				<title>Re: how to move objects?</title>
				<link>http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects#post-633079</link>
				<description></description>
				<pubDate>Sat, 14 Nov 2009 16:15:08 +0000</pubDate>
				<wikidot:authorName>ali</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>body.MoveTo(Vector3 position, Matrix orientation); isn't a good method for moving characters in real time, this method "teleports" the object, but I need something that will move objects smoothly.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects">how to move objects?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196596#post-632745</guid>
				<title>Re: RC-AirSim: r/c model airplane flight simulator</title>
				<link>http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator#post-632745</link>
				<description></description>
				<pubDate>Fri, 13 Nov 2009 23:24:20 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>haha very cool! love the sound effects</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-33556">General / Showcase</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator">RC-AirSim: r/c model airplane flight simulator</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196596#post-632566</guid>
				<title>RC-AirSim: r/c model airplane flight simulator</title>
				<link>http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator#post-632566</link>
				<description></description>
				<pubDate>Fri, 13 Nov 2009 19:04:02 +0000</pubDate>
				<wikidot:authorName>SomeCallMeTim</wikidot:authorName>				<wikidot:authorUserId>274272</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>RC-AirSim, the r/c model airplane flight simulator on Xbox 360 Indie Games uses JigLibX for the plane crash effect.</p> <p>I recently updated RC-AirSim to include this JigLibX powered plane crash effect. You can download the free demo version to your Xbox 360 from the xbox.com marketplace:</p> <p><a href="http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d80258550171/">RC-AirSim on the xbox.com marketplace</a></p> <p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/g0AoTkk7sT8&amp;hl=en_US&amp;fs=1&amp;" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <embed src="http://www.youtube.com/v/g0AoTkk7sT8&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344" /></object></p> <p>Thank you to the JigLibX community!!</p> <p>-Tim</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-33556">General / Showcase</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196596/rc-airsim:r-c-model-airplane-flight-simulator">RC-AirSim: r/c model airplane flight simulator</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195492#post-631749</guid>
				<title>Re: How to determine if physics body is inside of a TriangleMesh</title>
				<link>http://jiglibx.wikidot.com/forum/t-195492/how-to-determine-if-physics-body-is-inside-of-a-trianglemesh#post-631749</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 22:56:23 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>from testing with triangle meshes that have interiors performance really drops.</p> <p>however you can use the collision skin with a custom collision predicate function. This will allow collision to not take place but let you use the event as a notification of entry (i've heard someone on the forms here call this phantom physics, which i believe relates to havok terminology). I would do this with a box over your triangle mesh.</p> <p>Take a look at this tutorial and see if any of it could apply to your situation. <a href="http://jiglibx.wikidot.com/catch-collisionevents">http://jiglibx.wikidot.com/catch-collisionevents</a></p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195492/how-to-determine-if-physics-body-is-inside-of-a-trianglemesh">How to determine if physics body is inside of a TriangleMesh</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196134#post-631733</guid>
				<title>Re: how to move objects?</title>
				<link>http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects#post-631733</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 22:43:20 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>body.MoveTo(Vector3 position, Matrix orientation);</p> <p>this should work with a body using collisionskin containing box, sphere, and or capsules</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects">how to move objects?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195492#post-631174</guid>
				<title>Re: How to determine if physics body is inside of a TriangleMesh</title>
				<link>http://jiglibx.wikidot.com/forum/t-195492/how-to-determine-if-physics-body-is-inside-of-a-trianglemesh#post-631174</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 10:37:25 +0000</pubDate>
				<wikidot:authorName>jacc</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Does anyone have any possible solutions for this at all? It kind of seems something should be part of JigLibX, its just I'm not sure where it is - or is this not the case?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195492/how-to-determine-if-physics-body-is-inside-of-a-trianglemesh">How to determine if physics body is inside of a TriangleMesh</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196134#post-631149</guid>
				<title>how to move objects?</title>
				<link>http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects#post-631149</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 09:35:51 +0000</pubDate>
				<wikidot:authorName>ali</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>I really can't figure it out, I used Body.Velocity it does work, but it seems buggy. Also I tried to create Controller and use Body.AddBodyForce(), again fail. Does anyone know how to move Body? if you have working code of this, post it, please.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196134/how-to-move-objects">how to move objects?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195582#post-631074</guid>
				<title>Re: Help Integrating JigLibX into a game</title>
				<link>http://jiglibx.wikidot.com/forum/t-195582/help-integrating-jiglibx-into-a-game#post-631074</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 06:52:38 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <div class="code"> <pre> <code>CharacterObject.CharacterBody.DesiredVelocity = Direction * movement * (float)e.Time.ElapsedGameTime.TotalMilliseconds * 3.0f;</code> </pre></div> <p>assuming direction is a normalized vector3 :</p> <p>if movement is the speed ( units per second you would want the above code to look like this</p> <div class="code"> <pre> <code>CharacterObject.CharacterBody.DesiredVelocity = (Direction * movement);</code> </pre></div> <p>but if movement is a delta distance on the direction it would be</p> <div class="code"> <pre> <code>CharacterObject.CharacterBody.DesiredVelocity = (Direction * movement) / (float)e.Time.ElapsedGameTime.TotalSeconds;</code> </pre></div> <br /> this code isnt as stable as the first function where movement is the speed. (you should check that elapsedgametime.totalseconds is not zero and if it is decide if you want to set the desired velocity to zero or unchanged. )<br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195582/help-integrating-jiglibx-into-a-game">Help Integrating JigLibX into a game</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196078#post-631073</guid>
				<title>Re: intersection detection</title>
				<link>http://jiglibx.wikidot.com/forum/t-196078/intersection-detection#post-631073</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 06:52:17 +0000</pubDate>
				<wikidot:authorName>nikita</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>the problem was in ImmovableSkinPredicate.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196078/intersection-detection">intersection detection</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-194925#post-631068</guid>
				<title>Re: question about gravity</title>
				<link>http://jiglibx.wikidot.com/forum/t-194925/question-about-gravity#post-631068</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 06:45:27 +0000</pubDate>
				<wikidot:authorName>PGlynn</wikidot:authorName>				<wikidot:authorUserId>387675</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>what does your timestep look like? could you post the code where you're calling Integrate on the PhysicsSystem? If simulation overall is slow ( not just gravity ) you might want to take a look at that.</p> <p>this is a good example of a timestep approach <a href="http://jiglibx.wikidot.com/forum/t-60817/bouncing-bodies-and-performance">http://jiglibx.wikidot.com/forum/t-60817/bouncing-bodies-and-performance</a></p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-194925/question-about-gravity">question about gravity</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-196078#post-631033</guid>
				<title>intersection detection</title>
				<link>http://jiglibx.wikidot.com/forum/t-196078/intersection-detection#post-631033</link>
				<description></description>
				<pubDate>Thu, 12 Nov 2009 05:16:07 +0000</pubDate>
				<wikidot:authorName>nikita</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>hello everyone,<br /> I'm trying to code one feature for my 3rd person game, i have the camera class and class for character, the problem is in camera class, it always moves after character(it's normal), but when the character is situated in front of some object, and camera is behind it's a problem. For solving this I want to move camera closer to character, when such situation appears, then camera will take it initial state, corresponding to character position.<br /> I tried to use the technique that had been used in jigglegame for picking object with a mouse. this is it:</p> <div class="code"> <pre> <code> float frac; CollisionSkin skin; Vector3 pos, normal; ImmovableSkinPredicate pred = new ImmovableSkinPredicate(); PhysicsSys.CollisionSystem.SegmentIntersect(out frac, out skin, out pos, out normal, new Segment(Camera.Position, Character.Position), pred); if ((skin != null )&amp;&amp; (skin.Owner != null)&amp;&amp;(skin.Owner != Character.collisionBody)) { // problem } else { // no problem }</code> </pre></div> <p>Logically it must detect if something is situated between camera and character, but this code doesn't work. Where am I mistaken?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-196078/intersection-detection">intersection detection</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195992#post-630830</guid>
				<title>How to detect objects within a certain distance of an object</title>
				<link>http://jiglibx.wikidot.com/forum/t-195992/how-to-detect-objects-within-a-certain-distance-of-an-object#post-630830</link>
				<description></description>
				<pubDate>Wed, 11 Nov 2009 23:49:52 +0000</pubDate>
				<wikidot:authorName>Tom</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>How would you go about finding all objects within a certain distance so you can then add forces to all objects within that certain distance, would you use a bounding sphere or something similar? how would you go about doing this, and how would you set it up?</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195992/how-to-detect-objects-within-a-certain-distance-of-an-object">How to detect objects within a certain distance of an object</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195979#post-630794</guid>
				<title>Pair of questions about Collision Handlers</title>
				<link>http://jiglibx.wikidot.com/forum/t-195979/pair-of-questions-about-collision-handlers#post-630794</link>
				<description></description>
				<pubDate>Wed, 11 Nov 2009 22:55:07 +0000</pubDate>
				<wikidot:authorName>vandop</wikidot:authorName>				<wikidot:authorUserId>400128</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi Everyone!</p> <p>I got two problems, I'm handling collisions with other objects with this:</p> <div class="code"> <pre> <code>YourObject.Skin.callbackFn += new CollisionCallbackFn(handleCollisionDetection);</code> </pre></div> <p>1. So, when I put a body as Immovable, is not generated an event… is normal? I can change this behavior?</p> <p>2. Imagine that you want to kill the object when collide with it, so how can I destroy the object and stop receiving collision events from it? I'm trying body.DisableBody(), but I got an error in CollisionTest:\</p> <p>Please help me, if you can.</p> <p>Thanks and sorry about english.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195979/pair-of-questions-about-collision-handlers">Pair of questions about Collision Handlers</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195108#post-630320</guid>
				<title>Re: TriangleMesh not moving?</title>
				<link>http://jiglibx.wikidot.com/forum/t-195108/trianglemesh-not-moving#post-630320</link>
				<description></description>
				<pubDate>Wed, 11 Nov 2009 09:35:54 +0000</pubDate>
				<wikidot:authorName>Stig-Rune Skansgård</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi again!</p> <p>Thanks for your help and input. I have mentioned this to the other guys, and we'll see what we choose to do (I personally like the sound of that tool).<br /> Nice to hear that you have played the game:D<br /> The current world record (as far as we know) is 24,15sec (MINE:D). can anyone beat it?</p> <p>P.S:<br /> I'm not an official team member, so i cant take any credit for the game in any way. I'm just helping them getting it over to the XBox:)</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195108/trianglemesh-not-moving">TriangleMesh not moving?</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-194925#post-630010</guid>
				<title>Re: question about gravity</title>
				<link>http://jiglibx.wikidot.com/forum/t-194925/question-about-gravity#post-630010</link>
				<description></description>
				<pubDate>Tue, 10 Nov 2009 23:58:16 +0000</pubDate>
				<wikidot:authorName>nikita</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>thank you for small and interesting lection in physics, but I had a pleasure to study this discipline in school.<br /> I run jiglib on pc, but i sure that the problem isn't in slow perfomance of my hardware, just because the jigglegame runs perfectly. I have no idea why the objects behave that way in my game. And, yes, PhysicsSystem.Gravity is exactly what I was looking for, -100 for Y-axis is ideal in my case.<br /> Thank you for your kind instructions, Mr. Benjamin Dobell.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-194925/question-about-gravity">question about gravity</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195582#post-629615</guid>
				<title>Re: Help Integrating JigLibX into a game</title>
				<link>http://jiglibx.wikidot.com/forum/t-195582/help-integrating-jiglibx-into-a-game#post-629615</link>
				<description></description>
				<pubDate>Tue, 10 Nov 2009 16:48:04 +0000</pubDate>
				<wikidot:authorName>Vaaaan</wikidot:authorName>				<wikidot:authorUserId>392840</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>You want to move the character using a controller and forces, not MoveTo.</p> <p>Look here: <a href="http://jiglibx.wikidot.com/controllers-and-forces">http://jiglibx.wikidot.com/controllers-and-forces</a></p> <p>(Edit - I'm assuming.. someone can correct me if I'm wrong)</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-34271">General / Help</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195582/help-integrating-jiglibx-into-a-game">Help Integrating JigLibX into a game</a>
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://jiglibx.wikidot.com/forum/t-195102#post-629546</guid>
				<title>Re: Bug in new GetPoint</title>
				<link>http://jiglibx.wikidot.com/forum/t-195102/bug-in-new-getpoint#post-629546</link>
				<description></description>
				<pubDate>Tue, 10 Nov 2009 15:47:57 +0000</pubDate>
				<wikidot:authorName>noone88</wikidot:authorName>				<wikidot:authorUserId>91802</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>uploaded.</p> <br/>Forum category: <a href="http://jiglibx.wikidot.com/forum/c-33557">General / Bug Reports</a><br/>Forum thread: <a href="http://jiglibx.wikidot.com/forum/t-195102/bug-in-new-getpoint">Bug in new GetPoint</a>
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>