physics-engine


Is there an upper limit on velocity when using box2d?

坚强是说给别人听的谎言 提交于 2020-01-19 15:40:53
问题 I'm using box2d for physics simulation. I'm moving a circle using arrow keys by applying impulse on the body when ever a key is pressed. Unfortunately, the circle moves excruciatingly slow and doesn't seem to accelerate like a true physical body is supposed to. My world's dimensions are 400x800 pixels. The radius of the circle body is 20f. According to this, the problem can be solved by scaling the circle radius down when creating it and scaling up after getting the body position during

how to control the speed of animation, using a Bezier curve?

你。 提交于 2020-01-16 02:50:47
问题 I found formula only for vector coordinates of cubic curve who help in depicts(build vector image). Here it is: B(t) = (1-t)^3*P0 + 3*t*(1-t)^2*P1 + 3*t^2*(1-t)*P2 + t^3*P3 See more at: http://www.ams.org/samplings/feature-column/fcarc-bezier#sthash.85XhcT7H.dpuf This formula returns the coordinates of the vector, but I can not understand how they can influence the speed of the animation, as in http://cubic-bezier.com/#.17,.67,.83,.67. Please, direct me to the right way so that I could

Speed of C++ operators/ simple math

拜拜、爱过 提交于 2020-01-06 05:00:09
问题 I'm working on a physics engine and feel it would help having a better understanding of the speed and performance effects of performing many simple or complex math operations. A large part of a physics engine is weeding out the unnecessary computations, but at what point are the computations small enough that a comparative checks aren't necessary? eg: Testing if two line segments intersect. Should there be check on if they're near each other before just going straight into the simple math, or

fast dirty approximation of center of (list of 3D vertex) that forms a very shallow convex hull

寵の児 提交于 2020-01-04 14:16:40
问题 I want to find XY of the center (red) of a convex-hull points (orange circles) set that is a result from collision detection. Using separating-axis technique, I know for sure that the convex shape (pink) is relatively thin in Z-axis . In >90% of my use cases, the amount of vertices is not more than 8. My poor algorithm (AABB) ... MCVE I tried to implement it by calculating the center point of AABB. However, when I use it in real Physics simulation, the collision point (red) is not accurate

Centroid of convex polyhedron

北城余情 提交于 2019-12-22 04:50:12
问题 I have a closed convex polyhedron which is defined by an array of convex polygons (faces) which are defined by arrays of vertices in 3D space. I'm trying to find the centroid of the polyhedron, assuming uniform density. At the moment I calculate it with the algorithm in this pseudo-code. public Vector3 getCentroid() { Vector3 centroid = (0, 0, 0); for (face in faces) { Vector3 point = face.centroid; point.multiply(face.area()); centroid.add(point); } centroid.divide(faces.size()); return

How to stop the forces acting on a body in box2d

此生再无相见时 提交于 2019-12-22 03:16:06
问题 I am using box2d on the iphone to create a game. I have a body that is effected by gravity to move down and not right or left. It will get hit by another body and will then be moving right or left. I then have a reset button which moves the body back to its starting point. The only problem is that it is still moving right or left. How can I counteract the forces that a ball is already traveling? How can I get rid of this right and left movement when I reset my game? 回答1: box2d automatically

How to stop the forces acting on a body in box2d

爱⌒轻易说出口 提交于 2019-12-22 03:16:06
问题 I am using box2d on the iphone to create a game. I have a body that is effected by gravity to move down and not right or left. It will get hit by another body and will then be moving right or left. I then have a reset button which moves the body back to its starting point. The only problem is that it is still moving right or left. How can I counteract the forces that a ball is already traveling? How can I get rid of this right and left movement when I reset my game? 回答1: box2d automatically

Slick2D and JBox2D. How to draw

谁说胖子不能爱 提交于 2019-12-17 10:24:18
问题 Before asking this i did A LOT of searching on the net. I just can't do it. It's a little hard for me to understand. So how do i draw the images at the right screen positions coresponding to bodies in world position? Thanx. If anyone else finds himslef in front of the same obstacle i posted a HOW TO, thanx to normalocity's good explanation. You can find it here: http://romeo.akademx.ro/2012/04/06/slick-and-box2d/ This is the render function: public void render(GameContainer container,

How to apply rotation to a body in Bullet Physics Engine?

烈酒焚心 提交于 2019-12-14 01:21:22
问题 I have rotation values (roll, pitch, yaw). I would like to apply that rotation to a body, but I have no idea how to do that. 回答1: The most straightforward way would be to directly set the world transform for a rigid body, either through a motion state or by direct setting. To get a transform from roll, pitch, and yaw, you could use: btRigidBody * rigidBody = //... btTransform tr; tr.setIdentity(); btQuaternion quat; quat.setEuler(yaw,pitch,roll); //or quat.setEulerZYX depending on the

Few rigidbody cause Bullet Physics slowly

时光怂恿深爱的人放手 提交于 2019-12-13 16:17:17
问题 I'm currently doing the job for intergrating physics engine, Bullet Physics, into my graphics engine, Before that, I implemented the easy collision system with SAP and Narrowphase algorithm, the cost of time was 3ms for SAP and Narrowphase with about 300 objects. Because of some bugs of my algorithm, I decided to change to the real physics engine, Bullet Physics. So I followed the tutorial by official articles. When I thought I know how to implement in my graphics engine, and the output

工具导航Map