I do really need help the sliding collision and flytrough problem
so here's my code for player movement:
public override void Update(GameTime gametime)
{
input();// this is where i modify the vector3 force variable
if (force.X != 0 || force.Z != 0)
this.CollisionMove.ApplyObjectForce(force);
else
this.CollisionMove.RemoveForces();
base.Update(gametime);
}
private void OnCollision(IMovableObject collider, IMovableObject collidee, SynapseGaming.LightingSystem.Collision.CollisionPoint worldcollisionpoint, ref bool collisionhandled)
collisionhandled = true;
//if i set this false the player bounce against the wall and
//if i keep pushing the direction he's eventually going to
//pass trough the wall else if i set this true the player
//remain stuck in the wall until i don't go in the very opposite way
So i need a really simple player movement(slide on walls and slopes) using the basic collision system without using external bepu or jiglibx or other and i think it would be really usefull for all a walktrough about player collision.
Hi bmgames,
The player controller needs to convert the move vector provided by the input to movement force, which is then pass into Applyforce().
While the input vector and movement force are the same on flat surfaces (without obstructions) the controller will need to conform the input vector to sloped surfaces and walls the object is resting on / hitting, so the movement force is parallel to the surface. This allows the object to slide across surfaces and up slopes.
Let me know if this helps!
Follow me on Twitter – development and personal tweetsAwesome XNA Videos – Lighting, Rendering, and game videos
JohnK "bobthecbuilder": Hi bmgames, The player controller needs to convert the move vector provided by the input to movement force, which is then pass into Applyforce(). While the input vector and movement force are the same on flat surfaces (without obstructions) the controller will need to conform the input vector to sloped surfaces and walls the object is resting on / hitting, so the movement force is parallel to the surface. This allows the object to slide across surfaces and up slopes. Let me know if this helps!
how can i apply what are you saying? then the bounce issues how can i solve it?
i will try this today and tomorrow if i come up with something i will share, any small example of smooth movement code would be appreciated, thanks
i've tried a lot but with no success at all the ship continue to bounce or to gat stuck in the geometry.
Hi again,
After having a really hard time on figure out how to use the built-in collision system without having the jerk/bouncy movement effect, i found a way out using the bepuphysics library (only the stable version 1 has the collision rule and the object tag fully working) and the bepumanager class created by Dean Wadsworth, i've created a controller class to meet my needs and it solved the sliding issues, slopes and even stairs movement.
There are several great bepu examples by community members all very well integrated imo (including Dean's) - those are excellent options.
I know we made some changes to the collision system after the 2.0.16 release for the upcoming player controller. The changes could be to eliminate the jumpiness (though I'm not sure and will have to look into it).
Was hoping this was going to read "We havebuilt a community plugin for BEPU and it's available in our next release" :-)
What I've found improves the movement is using a sphere. If I use a cube the player bounces like a kangaroo but the sphere bounding area is heaps better; still a little jumpy but more like a happy puppy than a bunny in a farm of carrots.
having the chance to use bepuphysics in the next release would be a nice feature, maybe the chance to switch between simple collision and physics would be awesome and add the tag proprieties for bepuobject for help out handling the custom collision rules in code. but it's not that difficult to integrate the bepuphysics lib i've got no more problem with that and the player goes smooth as i expected.