simulating maximum velocity
-
- Posts: 17
- Joined: Tue Apr 15, 2008 4:14 pm
simulating maximum velocity
I have a sphere in a frictionless world that continuously has new forces applied to it (to push it around in different directions). These forces build, and eventually the collision detection fails and the sphere passes completely out of the model it is contained in. Is there a good way to cap the linear velocity on a collidable object. Also, does anyone have any suggestions on ways to keep the sphere inside the model at high speeds (the model is an enclosed mesh)?
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: simulating maximum velocity
http://chunkyks.com/bulletthings.pdf
Alternatively, use continuous collision detection. There's a CCD example, and several threads on these forums talking about it.
Gary (-;
I described how to cap the speed of an object in that doc.Is there a good way to cap the linear velocity on a collidable object.
I did describe one way to do that in my doc, too, although it can get a little compute-intensive at very high speeds [basically, decrease the fixedTimeStep parameter to stepSimulation and increase maxSubSteps to compensate].Also, does anyone have any suggestions on ways to keep the sphere inside the model at high speeds (the model is an enclosed mesh)?
Alternatively, use continuous collision detection. There's a CCD example, and several threads on these forums talking about it.
Gary (-;
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: simulating maximum velocity
what kind of collision shape defines the boundary of your world? If it is convex you could use lots of btStaticPlaneShape objects.
I think tunneling occurs more easily with trimesh collision shapes than simple primitives like boxes, spheres, planes, etc
I think tunneling occurs more easily with trimesh collision shapes than simple primitives like boxes, spheres, planes, etc
-
- Posts: 8
- Joined: Sat Feb 16, 2008 5:12 pm
Re: simulating maximum velocity
Did you try to set the linear / angular damping of your rigid body. It doesn't exactly cap the velocity, but since the damping is dependent on the velocity the end result usually means speed capping, but in a more "realistic" way. Of course, your object will eventually grind to a halt, which you may not want...
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: simulating maximum velocity
I did. The problem is that either the terminal velocity [since that's effectively what you've implemented] is either really high, or my spaceship's damping is way too strong.
Perhaps it'll work if I change the mechanic to be highly damped instead of a more asteroids-like feel, but I *like* the asteroids-like feel
Gary (-;
Perhaps it'll work if I change the mechanic to be highly damped instead of a more asteroids-like feel, but I *like* the asteroids-like feel
Gary (-;
-
- Posts: 17
- Joined: Tue Apr 15, 2008 4:14 pm
Re: simulating maximum velocity
I haven't had a chance to read through the document yet, but thanks for the link. I hope to look through it soon and post a bit about my experience.
To answer a couple questions that were brought up, we are using a basic tri mesh which is basically a lot of complex tubular structures. We thought about trying to build this out of simpler objects, but that doesn't easily allow for model complexity we would need. I think it would work better if our spheres weren't inside of the collision mesh, but we haven't come up with a decent way to do this either.
Someone brought up dampening. I've played around with that both in this context, and because sometimes we need to slow these spheres down. It doesn't work well to solve this problem. In the end it just delays the inevitable, and it also requires you to either apply a lot of force initially to get the spheres moving as fast as they need to or you have to scale the damping up over time. But since apply force is cumulative, it merely delays the inevitable.
To answer a couple questions that were brought up, we are using a basic tri mesh which is basically a lot of complex tubular structures. We thought about trying to build this out of simpler objects, but that doesn't easily allow for model complexity we would need. I think it would work better if our spheres weren't inside of the collision mesh, but we haven't come up with a decent way to do this either.
Someone brought up dampening. I've played around with that both in this context, and because sometimes we need to slow these spheres down. It doesn't work well to solve this problem. In the end it just delays the inevitable, and it also requires you to either apply a lot of force initially to get the spheres moving as fast as they need to or you have to scale the damping up over time. But since apply force is cumulative, it merely delays the inevitable.