Sidewalks etc
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Sidewalks etc
So, on my game the Player is a Box, Height 2, Width and Lenght 1. I have tried using TriangleMesh, but it didn't work for 2 causes:
1 - Side Walks makes the Player Jump high enough to pass the walls
2 - After a time walking the Player starts jumping(there is no button to jump oO)
My last try was using loooootss of boxes, one in every place. My test with sidewalks TOO gave me an strange result, making the player almost fly =(.
I REALLLY want to use TriangleMesh, but this is going a little tricky =(
1 - Side Walks makes the Player Jump high enough to pass the walls
2 - After a time walking the Player starts jumping(there is no button to jump oO)
My last try was using loooootss of boxes, one in every place. My test with sidewalks TOO gave me an strange result, making the player almost fly =(.
I REALLLY want to use TriangleMesh, but this is going a little tricky =(
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
Kinda works with Capsule instead of Box ¬¬. WIth Capsule, the Player stops jumping. BUT, there's still a problem with the SideWalks, that I solved by using this:
FinalGravity.Y = 0; //That's ALL the Forces applied to the Body on this frame. Sorry, I'm not good on physics. Don't worry about the FinalGravity name
float GravY = BepuEntity.Entity.LinearVelocity.Y; //Get's the last Y velocity
if (GravY >= 0) // If GravY is Greater than 0
{
GravY = AnimationHelper.AnimateStatic(GravY, 0, 3); // Animated it, so it gets to 0(3 is the speed, 0 is the value I want to reach).
}
BepuEntity.Velocity = FinalGravity + new Vector3(0, GravY, 0);//Then I set the values here
Normally, I just use:
BepuEntity.Velocity = FinalGravity + new Vector3(0, GravY, 0);
Is that a good solution?
FinalGravity.Y = 0; //That's ALL the Forces applied to the Body on this frame. Sorry, I'm not good on physics. Don't worry about the FinalGravity name

float GravY = BepuEntity.Entity.LinearVelocity.Y; //Get's the last Y velocity
if (GravY >= 0) // If GravY is Greater than 0
{
GravY = AnimationHelper.AnimateStatic(GravY, 0, 3); // Animated it, so it gets to 0(3 is the speed, 0 is the value I want to reach).
}
BepuEntity.Velocity = FinalGravity + new Vector3(0, GravY, 0);//Then I set the values here
Normally, I just use:
BepuEntity.Velocity = FinalGravity + new Vector3(0, GravY, 0);
Is that a good solution?
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
And there's another problem:
Sometimes, I can pass through the TriangleMesh...
And If I run on the wall I can go up oO
Sometimes, I can pass through the TriangleMesh...
And If I run on the wall I can go up oO
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
ps.: The pass the triangle error works specially in a 90º wall (wall-wall with 90º difference)
Re: Sidewalks etc
Sorry, I can't understand the problem.
For the issue of passing through triangles, I can't really guess at the exact problem either, but I'd recommend trying out the latest development version: http://bepuphysics.codeplex.com/SourceC ... evelopment
There have been a lot of improvements to mesh collisions.
For the issue of passing through triangles, I can't really guess at the exact problem either, but I'd recommend trying out the latest development version: http://bepuphysics.codeplex.com/SourceC ... evelopment
There have been a lot of improvements to mesh collisions.
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
Norbo wrote:Sorry, I can't understand the problem.
For the issue of passing through triangles, I can't really guess at the exact problem either, but I'd recommend trying out the latest development version: http://bepuphysics.codeplex.com/SourceC ... evelopment
There have been a lot of improvements to mesh collisions.
Wow, I'm using that version =(
So, I thought it could be Mesh problems, but it didn't work with other either. I can pass through the wall like this:
|----------------------------
| \¬
| - There, on the corner, 90º angle =(
|
|
|
I am thinking that if I make a corner like this:
/------------------------
/
/
/
|
|
It could work, and the player won't pass throught the wall. Do you know why is this happenning?
EDIT: Click on the Edit button to see the Correct Corners, because the forum screwed it up, but Editting I can see =)
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
And just another thing, How can I test the Triangles Height, like I did with boxes, to Know what type of cover will the player take?
Re: Sidewalks etc
How are you controlling the character, and what are the dimensions of the shapes involved like?
If the character is being moved using teleportation (such as entity.Position += offset), collision response will be 'squishy' because there is no velocity to correct, leading to frequent failures. If this is the problem, use velocities to control the character instead.
If the character is hundreds or thousands of units tall, there will be numerical issues as well. I'm not sure if it would produce exactly what you're seeing, though. Different problems could also happen if the character is too small (<< 0.5).
Convex casts are another option, though they are a little trickier to use since there's no 'convex cast' query on all collidables. That will be coming soon.
If the character is being moved using teleportation (such as entity.Position += offset), collision response will be 'squishy' because there is no velocity to correct, leading to frequent failures. If this is the problem, use velocities to control the character instead.
If the character is hundreds or thousands of units tall, there will be numerical issues as well. I'm not sure if it would produce exactly what you're seeing, though. Different problems could also happen if the character is too small (<< 0.5).
Some series of ray casts would do the trick. Depending on what kind of functionality is required you can cast multiple horizontal rays to find an approximate height of an obstacle in some direction. Further rays could be used to find a more precise height, such as ray casting down from the first unblocked ray. Here's an example: If all the horizontal rays find the obstacle, then you can fairly safely assume that it's a full wall.And just another thing, How can I test the Triangles Height, like I did with boxes, to Know what type of cover will the player take?
Convex casts are another option, though they are a little trickier to use since there's no 'convex cast' query on all collidables. That will be coming soon.
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
I was using Velocity in a Box with width and lenght 1, and height 2;Norbo wrote:How are you controlling the character, and what are the dimensions of the shapes involved like?
If the character is being moved using teleportation (such as entity.Position += offset), collision response will be 'squishy' because there is no velocity to correct, leading to frequent failures. If this is the problem, use velocities to control the character instead.
If the character is hundreds or thousands of units tall, there will be numerical issues as well. I'm not sure if it would produce exactly what you're seeing, though. Different problems could also happen if the character is too small (<< 0.5).
Some series of ray casts would do the trick. Depending on what kind of functionality is required you can cast multiple horizontal rays to find an approximate height of an obstacle in some direction. Further rays could be used to find a more precise height, such as ray casting down from the first unblocked ray. Here's an example: If all the horizontal rays find the obstacle, then you can fairly safely assume that it's a full wall.And just another thing, How can I test the Triangles Height, like I did with boxes, to Know what type of cover will the player take?
Convex casts are another option, though they are a little trickier to use since there's no 'convex cast' query on all collidables. That will be coming soon.
Now I'm using a Capsule, + - same size.
I'm thinking, how could I do the Ray testing? Use two rays, on the low object height and on the hight object height, so if the tall Ray finds an Object it's a big wall, and if the low ray finds a wall and the tall doesnt, it's a small wall?
Re: Sidewalks etc
Provided that the environment also has acceptable dimensions, I'm not sure what the problem is. I'll probably need a reproduction case to figure it out for sure.I was using Velocity in a Box with width and lenght 1, and height 2;
Now I'm using a Capsule, + - same size.
That would work. In the tall case, depending on your environment, you may want to check to see if the low ray is hitting anything. If the tall ray hits something and the low ray doesn't, the character's feet are exposed and it's not particularly good cover.I'm thinking, how could I do the Ray testing? Use two rays, on the low object height and on the hight object height, so if the tall Ray finds an Object it's a big wall, and if the low ray finds a wall and the tall doesnt, it's a small wall?
-
- Posts: 40
- Joined: Mon Sep 06, 2010 9:22 pm
Re: Sidewalks etc
The Environment is acceptable, it's a street =)Norbo wrote:Provided that the environment also has acceptable dimensions, I'm not sure what the problem is. I'll probably need a reproduction case to figure it out for sure.I was using Velocity in a Box with width and lenght 1, and height 2;
Now I'm using a Capsule, + - same size.That would work. In the tall case, depending on your environment, you may want to check to see if the low ray is hitting anything. If the tall ray hits something and the low ray doesn't, the character's feet are exposed and it's not particularly good cover.I'm thinking, how could I do the Ray testing? Use two rays, on the low object height and on the hight object height, so if the tall Ray finds an Object it's a big wall, and if the low ray finds a wall and the tall doesnt, it's a small wall?
Going to test the Ray Casting here =)
ANDD, THANKS for the REALLY FAST reply on a MONDAY!