Tag Info

Hot answers tagged

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 ...


3

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 ...


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). ...


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 ...


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 ...


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.


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 ...


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 ...


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

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 ...


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: ...



Only top voted, non community-wiki answers of a minimum length are eligible