Tag Info

New answers tagged

2

I don't believe there's an elegant solution to that problem. It's something I put a lot of time into investigating a few years ago writing my own collision detection. The solution I ended up using was iterative: Simple (no sweeping) GJK to find the minimum distance between object A (the fat ray cast) and object B (the potential collider -- this is after ...


1

GPUs can branch conditionally. It's just more expensive when not all threads in the SIMD execution follow the same path. What will actually happen is that the pixels that break out of the loop will "disable" themselves so that when all pixels in the group are out of the loop some will have the variables from earlier loops iterations.


0

So, you want the angle of velocity relative to the x-axis? That'd be atan(V3.y/V3.x) and atan(V4.y/V4.x) for Q3 and Q4, respectively. Though, since the balls are almost aligned along the y-axis in relation to each other, it looks like maybe you're looking for the angle of V3/V4 relative to the surface at the point of impact, even when that doesn't line up ...


0

maby this can help you http://en.wikipedia.org/wiki/Coefficient_of_restitution there is a break down of the entire problem


2

For a one-off change of velocity, I'd recommend changing velocity yourself. So rather than applying a force to the object, try something like rigidbody2D.velocity += shooter.velocity after you create the shot and figure out the regular shooting velocity. Secondly, it'd probably be best not to count on the speed difference to avoid the shooter being ...


4

The first step in implementing a physics engine is to model the movement of each object in form of a 3d velocity vector. Each object has current velocities in x, y and z direction. Each logic tick of your game engine, the object is moved by its current velocity. Changing the velocity-vector of an object by applying an acceleration-vector is the primary ...


0

The question sounds like it is describing a problem with object penetration. (When one circle is overlapping the other and it causes the deflection to be calculated wrong). This is a problem with the precision of the collision tests. If I have understood the problem correctly, what is happening is that collision detection only happens once per frame but the ...


0

Your solution is correct, but only for a very specific type of collision. Even the gif is really only valid if a moving circle hits a stationary circle - not if two circles are moving and hit each other. Since you probably want to be able to make this work regardless of how the circles are moving when they collide, you'll need to do some calculations. ...


0

I'm not entirely certain this will help with your physics problem, but I remember reading about two different types of force options when you use AddForce. One adds a ramping force and the other is an instantaneous impulse force. Might be worth reading into. :)


0

I solved it using kinematics but got a much more complex equation than what you have already.. I think it should work, and I've double-checked the math (and did a bunch of it using wolfram), but I'm wary of it just because of how long the equation came out to be. where y = the height of the second ramp - the end height of the first ramp, and g is positive ...


0

AFAIK the standard way of doing things in Unity is to assign a (non physical) Character Controller to your player. The character controller just sets the velocity of a body with some simple rules (exactly as you want). Collisions with physical objects are faked by treating the character as a kinematic object that can't be affected by forces. This can lead ...


0

flocking with independent behavior based on situation, where part of that behavior is broadcast message and part is cascade to nearest neighbor that then informs rest of individuals in the unit. That way if an order to lose formation is given, 5 feet between men, it broadcasts to rest of unit. If close formation is ordered it broadcast also. That order ...


0

When Microsoft created the XNA framework (I know you're using Java, but the math is the same), they created a built in method to create a Quaternion from an axis and angle. The method they used (and you can "reflect" their managed code to verify it, see below) is the same as your first snippet: public static Quaternion CreateFromAxisAngle(Vector3 axis, ...


1

I think you've misinterpreted the formula. You should review the Section 2.1.7 - The Scalar Product. The dot (·) represents a dot product (or scalar product (please use one of these terms because it's what it is)). The scalar product is defined like this: with vectors a and b, and scalar value s, s = a · b = axbx + ayby And, as defined, it gives a ...


0

If you only want to change the physicsBody to static, you can do this using cocos2d-x scheduleOnce with delay = 0.0f. You might have to manually schedule the physics step but it should work in any case. For instance, let's say you want to make shapeA static when a collision is detected: bool HelloWorldScene::onContactBegin(PhysicsContact& contact) { ...


1

You could consider breaking down a single physical frame based on the absolute magnitude of the acceleration vector for any body in the simulation. Essentially, you could map the number of digits in the acceleration magnitude to the number of iterations per each physical frame: timeSlicesRequired = ceil(log10(maximumMeasuredAcceleration)) adjustedTimeStep = ...


1

One simple way to simulate soft bodies is to connect together small rigid bodies with elastic joints. Then the difficult part is to fine tune your model's parameters and map the texture to the underlying model. The following blog post provides an implementation of a deformable ball with cocos2d engine: ...


0

I changed the code used to update things in the physics engine to this (just removing, recreating, then reading the rigidbody) (PhysicsEngine is a separate helper class containing the dynamicsWorld, anything beginning with an m_ is a private variable of the collider class): physicsEngine.removeRigidBody(m_rigidbody); m_transform = new Transform(); ...


0

If you are trying to deduce difference in force and how it effects a single object with a change to its center of gravity, making each component of that object, a single object and then using its force to calculate any strain or pressure would seem to be the way to do it. If you have two weights on a bar, and they rotate around the center, and then you want ...


1

I want to update this considering the new shader stages recently added. Someone more familiar can probably be more thorough, but: such as a car's front end destroyed when it hits a wall? The new stages allow you to more-cheaply enhance low-poly models. You could generate an entire vehicle from a single cube's-worth of vertices (8). Given a relatively ...


2

I was able to solve this using trig instead of vector math. Here's how it looks as a triangle. Notice that since this is meant for a computer coordinate system, the y+ axis is down. Also the angles are as such: x+ = 0°, y+ = 90°, y- = -90°, and x- = ±180° Additionally, we know that line B's angle is ∠B = -10°. The speeds don't matter since they can be ...


0

This is how I would pose the problem: Then continue to substitute terms into each other until I find what I need. Considering your question I think what you need is d2. I guess the things you know are: P01, d1, v1 P02, v2 So try to make an equation that exhibits d2 = <only stuff you know>, from the set of equations in the drawing. that has to ...


1

I tried to solve it following @david van brink comment. P: intersection point (unknown) S1: car's starting point(2,2 here) S2: canon's starting point(3,12 here) |v1|: car's velocity length (25 here) |v2|: canon ball's velocity length (120 here) a: angle between the car's velocity and the X-axis (10 degrees here... or Pi/18) b: angle between the canon ball's ...


0

I was able to achieve a precise gravity simulation by applying the 'correction' said in this article: http://www.niksula.hut.fi/~hkankaan/Homepages/gravity.html Basicaly it consists in dividing the gravity by 2 in the very first frame/iteration when adding it to velocity.


3

It's because of the discreet time and the way you integrate. Because you step time forward at 1/50 of a second you're not guaranteed to hit the actual apex of 4.0, the delta is just not granular enough. (Try setting the delta time to 1/5000 and you'll see that it gets closer to 4, obviously that won't work for your game but it will show you the effect). ...



Top 50 recent answers are included