Facing manipulation
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
So I didn't understand why I'm at 2fps with only 25 tanks.
EDIT :
Without graphics
EDIT :
Without graphics
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
You have any suggestions ?
Re: Facing manipulation
Please re-read some of my posts.kavatortank wrote:You have any suggestions ?
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
How I can disable fixed time ?2) Watch out for external environmental issues like constant GC pressure slowing down everything. For example: you mentioned the physics took 16 ms, and that you had 10 fps. 10 fps corresponds to 100 ms per frame. The remaining non-physics 84 ms should probably be looked at first. If you're running with fixed time steps enabled, temporarily disabling them to get a clearer picture of update times might be a good idea.
How I can check if my terrain is too dense ?3) Make sure that collision geometry is not more complex than it needs to be. Be especially careful of MobileMeshes; they are very expensive. Make sure the terrain is not too dense.
Re: Facing manipulation
In an XNA game, use the IsFixedTimeStep property.How I can disable fixed time ?
The physics engine also has its own form of framerate independence: if you call Space.Update(dt), the engine will take as many steps are needed to simulate the accumulated time. Space.Update() with no parameters just takes a single step. For simplicity, it may be a good idea to just use the Space.Update() version to ensure consistency in timing.
Decrease its density to see if performance improves significantly. Compare it to the TerrainDemo. Try replicating your simulation and the slowdown in the TerrainDemo.How I can check if my terrain is too dense ?
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
How I can decrease its density, and what its density ?Decrease its density to see if performance improves significantly. Compare it to the TerrainDemo. Try replicating your simulation and the slowdown in the TerrainDemo.
Re: Facing manipulation
"Density" is just how many triangles there are in a given volume. So, if a tank overlaps 100 triangles at any given time, the terrain is very dense. If a tank overlaps 1-6 triangles at any given time, the terrain is pretty sparse.
So, to decrease density, make triangles larger.
So, to decrease density, make triangles larger.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
I don't know how to do thatSo, to decrease density, make triangles larger.
Re: Facing manipulation
Modify the AffineTransform parameter passed into the Terrain constructor. If you want to scale the terrain (and thus its triangles) up by a factor of 2, introduce a scaling factor of 2 into the transform. Check out the TerrainDemo's use of the scale-rotation-translation constructor of the AffineTransform for an example.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
Ok, but I notice any changes, but thanks.Norbo wrote:Modify the AffineTransform parameter passed into the Terrain constructor. If you want to scale the terrain (and thus its triangles) up by a factor of 2, introduce a scaling factor of 2 into the transform. Check out the TerrainDemo's use of the scale-rotation-translation constructor of the AffineTransform for an example.
The problem was that I didn't active the multithread, but with 30 tanks I have lags...
But now, I want to solve a problem.
I spoke about it before.
http://img812.imageshack.us/img812/1904/wheelsa.png
In this picture you can notice that wheels ( physics wheels ) don't have the right size. You told to me, that I should recode another wheelShape, but those classes seems really complex. Can you help me ?
Re: Facing manipulation
You don't need to make your own wheel shape. I only mentioned that in reference to "but how can I simulate box for each wheel ( to represent better collision )", since it sounded like you were referring to actually using a box for wheel collision detection.
If you just want to make your wheels match the graphical wheels, increase the shape's radius. With cylinder-cast wheels, this will boost your tank off the ground a little but you can shorten the suspension to compensate.
Or, use a RayCastWheelShape instead. A RayCastWheelShape's radius is only used to determine the graphical transform.
If you just want to make your wheels match the graphical wheels, increase the shape's radius. With cylinder-cast wheels, this will boost your tank off the ground a little but you can shorten the suspension to compensate.
Or, use a RayCastWheelShape instead. A RayCastWheelShape's radius is only used to determine the graphical transform.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
But I have a question.
Why the wheels back and descend ( go up and down) so quickly? Normally the wheels are not moving censer.
Why the wheels back and descend ( go up and down) so quickly? Normally the wheels are not moving censer.
Re: Facing manipulation
If you're referring to wheels' travel time along the suspension, they are fast because they do not actually exist. Wheels are just shape casts in the direction of the suspension, not actual physical objects. That's also why wheels cannot 'slip' in the Vehicle- when wheels spin, it a graphical effect based entirely on the relative velocity at the earliest cast intersection point.
(Down the road, I may redo the vehicle to support more physical behaviors, but that will be a while.)
(Down the road, I may redo the vehicle to support more physical behaviors, but that will be a while.)
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: Facing manipulation
Okay, so how can I réusoudre this problem? By putting physical box that does not collide with the vehicle but will block external objects, like that the wheels will not have bizar movement? Do you have another solution?
Re: Facing manipulation
I'm not sure what behavior you are trying to stop. If you're referring to objects coming in from the sides of the tank and the wheels rise to be on top of them rather than colliding, then yes, you would need to modify the shape of the tank such that objects had a harder time sliding in from the side. You could lower the body or add additional side boxes to a compound shape.
However, doing that will make the tank bottom out quicker because the body is effectively lower. You could assign collision rules such that the extra side-blocker shapes don't collide with terrain but do collide with other objects, but this would take some effort.
If you just find that wheels tend to jump up when objects come near the tank's sides, even without sliding under, then the wheels are probably extending outside of the tank's collision or are very close to it. To reduce this effect, bring the wheels into the tank body a little more so that there's a safety margin.
The 'proper' solution to this sort of thing would be some form of physical wheel instead of a shape casted wheel. You can see an example of such a physical wheel in the SuspensionCarDemo. However, these are harder to set up, harder to get stable at high speeds, and usually take more computational resources. Additionally, since they're just regular entities and constraints, you don't have very fine grained control over some tuning factors that the Vehicle supports.
However, doing that will make the tank bottom out quicker because the body is effectively lower. You could assign collision rules such that the extra side-blocker shapes don't collide with terrain but do collide with other objects, but this would take some effort.
If you just find that wheels tend to jump up when objects come near the tank's sides, even without sliding under, then the wheels are probably extending outside of the tank's collision or are very close to it. To reduce this effect, bring the wheels into the tank body a little more so that there's a safety margin.
The 'proper' solution to this sort of thing would be some form of physical wheel instead of a shape casted wheel. You can see an example of such a physical wheel in the SuspensionCarDemo. However, these are harder to set up, harder to get stable at high speeds, and usually take more computational resources. Additionally, since they're just regular entities and constraints, you don't have very fine grained control over some tuning factors that the Vehicle supports.