Search Forums
-
You need to calculate the penetration depth and move the object that distance away from the collision along the contact normal. Glad the collision batching helped move you along though :)
-
[quote user="Zomba"]
@ George: My script is partly based on the tutorial you mentioned. I could not use that particular movement, because it did not
work with the boundingbox I created. Now there is collision, but the max jump height was failing for a couple of days...en that brought me here :)
@ Charles: thank you for the example you ...
-
Cool! I'll have a look at that.
I guess I can do them in tandem, makes me think about my own physics too. Let us know how you get on, one day you could post a tutorial on it :D
-
No worries :)
OK. I had just started a series for none programmers comming to XNA, I guess I can put it on hold and see if I can come up with a usable physics sample for 2D, it will most likely be very simple physics as I only dabble in it (sounds like black magic lol)
I'll come back here and put a link to my blog post when it's up. I ...
-
Then if you are rendering any 3D, which it looks like you are then I suggest altering ALL the spritebatch.Begin calls so they save state. The min/max depth should be what ever you need it to be, to me 0 and 1 would not be a useful combination. There is a ratio for this (not that I am that up on it), have you tried other ranges? I would try a min ...
-
I used a similar method in a sample I put up ages ago, doing ray intersections on terrain, you can find the post here. The clip there shows the terrain being modified, you can't see the mouse position in the clip though.. Hope it helps :)
-
If you use the method I posted you can limit the jump height in this line:
accVelocity += new Vector2(0, -250);
by changing the value -250 to something else. What I would do would have something like a jump strength field that I can set, so then I could have a pick up that increased this value and make me jump higher or a nasty pickup that will ...
-
If you use a similar physics movement method that I used in this post, then you can set the mass for A and B to 0 (imoveable objects) and then use a collision nomal along with a restitution value to alter C's velocity. If you batch the collisions up then C's velocity will b adjusted twice, if it hits at exactly the same time then they ...
-
What are the MinDepth and MaxDepth values you have set up in the Viewport? Extreme values can give odd effects.. Also, if I remembr correctly that GSM sample does not save state whe it makes it's spriteBatch.Begin calls.
-
You need to not action the collision data as you get it, rather batch it all up. I use a collision list and once I have collected all collision data for that frame in it, action them in turn.
I have been thinking of dong a post on some simple physics, if I ever get time I'll post it up.