Tag Info

New answers tagged

0

For stuff like this I would use elliptic orbits, this guaranties stability by definition. Due to limited precision of floating point numbers you will reach a point where you will lose stability I guess. This often no big deal in physics engines because you have energy loss at each bounce so you're convergent. Do you really need integration here ? Edit: ...


0

It seems to me that you haven't defined enough of what is happening in your system, to know how it should move. I.e., I think you are missing the forces involved when one of the two component objects rotates itself. In real inertial physics, nothing moves without force being applied, but it sounds like your model for the component rotation may not include ...


1

You have at least one error. This is incorrect: float newDistance = newPointOnPlane.x + newPointOnPlane.y + newPointOnPlane.z It should instead be: float newDistance = glm::dot(newPointOnPlane, newNormal); Because the "distance" of a plane is the distance along the normal to the plane origin, which is given by the dot product between the normal and the ...


0

Here is how I've been able to do it: Remove the rigidbody from the world. Destroy the old shape(not sure if this is needed, but I do it for safe measure). Create the newShape. Use rigidbody.setCollisionShape(newShape). It is on the btRigidbody but is not in the API because it is an inherited from btCollisionObject. newShape.calculateLocalInertia(mass, ...


1

I don't think there is much you can do to prevent this, because essentially your graph shows you the problem. The physics system has to apply the force according to the tick (or substep) delta, meaning that at some point it is just not possible to update the position of an object independent of the framerate. That is also the reason why you can specify the ...


0

This is not something that you can cover in a question. To get proper results you need a physics engine that supports soft bodies collisions. Use something like this. Essentially the characters body is supposed to stick to the ground because it doesn't stop when it hits the ground. It's like a ball hitting a blanket, or a spring more precisely. So when the ...


2

I belive there is no friction. Add a physic material with a friction.


0

There is no need to calculate the direction, instead you can use interpolate between the two positions. Interpolation is when you calculate a position between start and end using an interpolant which is 0 at the start and 1 at the end. The simplest of these is linear interpolation, often shortened to lerp. Many game api's has this function somewhere but you ...


4

The most common approach to this is to detect if the character is standing on a solid surface before allowing them to jump. This restricts players to a single jump since the first jump puts them in the air, then they're no longer on a solid surface, so the next time they try to jump, they can't. For Box2D specifically you can see how to implement that here: ...


0

It doesnt work, because you dont count fingers on screen, so no matter how many fingers will be on screen, touchDown always returns first touched coodrinates, next touches are ignored. If you want to use multitouch, then you have to make use of pointer variable in touchDown method. Actually i answered very similar question once in stackoverflow, and im sure ...


1

You should be getting a RaycastHit2D object back from your test. You can access the hit info from that to get the distance and other information about the object you hit. Something like the following: RaycastHit2D leftHitInfo = Physics2D.Linecast(leftStart.position, leftEnd.position, layerMask); if(leftHitInfo.collider != null) { ...


1

You probably don't want to use AddForce, and definitely don't use Rotate for physics since it completely overrides the physics engine (and collisions). Use WheelColliders. They're specifically made for this purpose. I've used AddForce in conjunction with WheelColliders with extremely low friction to simulate arcade style hovering vehicles, but anything ...


1

If it should only hit with left, up, right, and down using Raycasts. Your code will look like this public float[] CheckCollisions() { Raycast hit; float[] collisions = new float[4]; if (Physics.Raycast(transform.position, transform.Vector3.Up, 100.0f, out hit)) collisions[0] = hit.transform.position - transform.position; else ...


1

If you want realism, follow the physics of a real car. 4 tires on the ground. Only front two can rotate. For front wheel drive, on each of the two front wheels, I believe rigidbody.addTorque(Vector3) is what you are looking for. But there is a lot more to it. And I am not a mechanical engineer, so you may need an expert in the field to know where the ...


2

Stabilizing the delta is not an option as I need different deltas for said effect, so I need to physics to be entirely independent there. Stabilising the delta time is your only option. If we could change the time step of a numerical integration and were guaranteed to get the same results, we could exploit this to get really accurate calculations with ...


2

Welcome to the wonderful world of integral calculus. Speed = distance / time Acceleration = distance / (time * time) So to get the correct answer you need to calculate the integral of your speed, and then the integral of your location. The math can be quite daunting, and in most cases it will be overkill and just make things more complicated. You can use ...


0

Calculating physics with a delta is generally not a good idea, not only because of the reasons you gave, but also because you get slightly different results every time you run the app even with similar frame rates, which already might be game breaking. Or, if the frame rate drops too low, fast moving objects can completely clip through each other. (Assuming ...


1

The problem with resolving collisions of an entity with voxels in an arbitrary order is that a collision with a voxel edge may be detected before a collision with a face which would have happened earlier. In this diagram a sphere is sliding along a voxel floor (right to left). Its velocity vector (blue) has a downwards component due to gravity. If collision ...


3

The Euler method as applied to games is pretty much just the naive Position + (Velocity * TimeSinceLastUpdate) formula I think you were getting at. The other methods (without getting into the calc too much) are just more accurate ways of estimating velocity and position based on multiple simultaneous forces, like friction, gravity, air density, etc. It's ...


1

You should be moving the car positive X axis instead of the environment around the car negative X axis. Then move the camera with the car.


0

The answer is an obvious no simply because "heavy rounding" doesn't alleviate the problem. Like you suggested the issue is with how floats behave on different architectures. Lets say you round things up. :) What happens with very large numbers? They are still exactly the same. Large numbers behave differently too on different architectures. Fractions, are ...


0

Edit: I did notice this about your code, but can't comment: float floor_mass = std::numeric_limits<float>::max(); float ball_mass = 1; float optimizedP = (2.0 * (a1 - a2)) / (ball_mass + floor_mass); What is the value of: float(ball_mass + floor_mass)? Rather than correcting your code, I will post a little of mine: Initially: ...


0

Most of your efficiency benefit can come from checking against a loose bound for your whole shape (box or sphere known to contain it). When you find that the ray "might" intersect it (because it intersects a sphere or box that's not much larger), then you pretty much need to check each face. You can skip faces whose normals point away from the ray, since a ...


2

One way you could do it is by simulating it as a grid of particles and springs, and then performing physics on each of the particles. For each filled pixel, if it has a filled neighbor pixel, add a spring with a rest length of 1 pixel, and a fairly high spring constant. Each filled pixel has a velocity, position, and mass. At each timestemp, move all of ...



Top 50 recent answers are included