Tag Info

New answers tagged

1

If having your overall collision surface look something like this is acceptable, then yes, use a couplefew sphere colliders parented together somehow, since spheres are cheap (in fact I think the reason they're cheap in physics is because they're restricted to distance checks from a point, which is why you can't transform them): Otherwise I would suggest ...


1

What you seem to have is a double pendulum which is inverted. Here, m2 is the player's center of mass. In order to remain in balance, L2 cannot be tangent to the ball (they would slip off) and m2 must remain nearly above f (otherwise they'd fall over). Obviously this would be complicated to manage in a game where you can't feel how you're balancing. A ...


0

SpriteKit uses SKAction objects to accomplish most of its functionality. What you're seeking is SKAction's followPath:duration: action. The following accomplishes this: UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointZero]; [path addQuadCurveToPoint:CGPointMake(deltaX/2, desiredHeight) controlPoint:CGPointMake(0, ...


3

In most game engines, physics objects live in their own world, and are connected to game objects through some special logic, responsible, for instance, for copying transformations and notifying about events like collisions. Your case sounds like it requires multiple physics worlds. Most physics engines will allow you to do that, as they are designed in a ...


1

Your primary problem is when you modify the velocity directly: rigidbody.velocity = moveDir * speed; Here, your moveDir variable is only getting its x value set, so the z value is zero. That means that whatever you did to change the velocity later on in the code, gets erased the very next frame when you use the above line of code. You can either not ...


1

for each object with a Physics RigidBody component you can check the Component options in the inspector... and iirc there will be check boxes and input fields to allow you to modify these values directly from the gui (Gravity Scale, Angular Drag, Drag, etc...). but if you check the documentation, all of those values also represent properties of that ...


0

So you're using Box2D, you should just let the engine handle collisions. (It is generally good to avoid directly setting fixture's position/rotation/speed - just apply forces. iforce2d (https://www.iforce2d.net/b2dtut/) has some awesome related tutorials.) What you currently are doing is manually setting the position of the ship to its previous position ...


0

First, the behavior you're describing is that of an aerodynamic vehicle with a single vector of force. A spaceship, flying in space, would operate in an entirely different manner. If this is still the desired behavior: Second, to utilize SpriteKit's efficiency, it might be best to use actions on your nodes. This isn't a requirement, but they exist ...


1

I've been puzzling with this in the creation of my physics based game. I've decided to settle with creating my animations used a skeletal key-frame based animations system (Similar to flash if you've used it). I will then create physics bodies for each 'limb' of my character. Each of these limbs will have forces applied (depending on the distance from the ...


3

I don't know the specifics of GameMaker, but this is how I achieved this effect in Unity. First I defined a Boundary class that defines the limits of the play area. This class includes a method trimToBoundary that takes an arbitrary coordinates and clamps them to the boundary space, like this Mathf.Clamp (x, xMin, xMax), Mathf.Clamp (y, yMin, yMax), Then ...


3

Inverse kinematics. That is the word I think you are looking for (easily googlable). As for libraries, I do not think so. It is very rare technique - the only game I can think of using inverse kinematics is Kingdom Come: Deliverance.


1

Mmmm, interesting question. The first approximation could be the following: simply divide your character into a set of physical bodies. I mean, you could calculate resultant force on legs, feet, arms and hands and operate with the results. Think in Rayman, for example. It can be a good model to start with. The character would be formed by head, body, hands ...


0

I would suggest not setting your vertical speed to -10 as this is essentially doubling the effect of gravity which can have some serious adverse effects later on. I would replace the collider with a spherical based one on your character: This should help smooth out collisions and contact with the ground as opposed to a square based collider which will ...


-2

So I figured it out by myself (gee thanks a lot, downvoter) I looked inside my ThirdPersonController script and took a look around once more. I found this: function ApplyGravity () { if (isControllable) // don't move player at all if not controllable. { // Apply gravity var jumpButton = Input.GetButton("Jump"); // When we ...


0

I spent a day refactoring and trying the approach listed as Potentially Viable above, and it worked! Basically, it functions like this: I made a Class named Stance, which defines an angle for all of the joints. The class also has a Vector2 coordinate, corresponding to a position on the joystick. A class named StanceMap keeps track of all of the stances ...


1

Finally, I found the geometric solution! I will share the code in JavaScript with three.js which is a 3d library, provides math stuff to JavaScript. var face = contactInfo.face, normal = contactInfo.normal, distance = contactInfo.distance, point1 = new THREE.Vector3(), point2 = new THREE.Vector3(), direction = new ...


1

In case you're looking for a pure geometric solution and not a physics one, i.e. you're not using gravity so that the ball falls down basically on an inclined plane, then I suggest you look at it as finding the position of the center after the collision so that the ball is tangent to both the wall and the ground. Unfortunately I cannot make a fancy drawing, ...


0

Another scheme I encountered is the one from Position Based Dynamics where you: Integrate velocity and position (unconstrained) Collision detection Constraint solver (position based) Update velocities from new positions (basically you're integrating them using the computed constraint forces, just like you did for the positions) This is to show that there ...


1

Typically a physics engine will follow these steps: Broad-phase collision detection. Typically using bounding volumes, this reduces the set of all objects to a small subset of potentially colliding objects. Some data structures to handle broad-phase are AABB trees, KD-trees, Octrees, etc. Narrow-phase collision detection. From the subset of potential ...


4

What you have here are two constraints that need to be resolved. On one hand, you need the sphere to stay outside the wall, by pushing it along the normal. On the other hand, you have the constraint that the sphere needs to stay attached to the ground. If you don't want to try writing fancy solvers, the easiest way to do this is to use an iterative solver. ...


0

Friction coefficient is equal to tangent of the maximum angle before the item will slide. You need to set coefficient greater then 1. There is a function in the Settings class - MixFriction. It's used to calculate the friction coefficient between surfaces, by default it's a geometric mean, you can change this too.


1

Your car is slipping for the same reason that a car hanging up-side down, riding the ceiling, with 100% friction would slip. 100% friction roughly means that 100% of the force exerted via the wheels on the terrain is used to counter movement perpendicular along the normal of the terrain. But this force still isn't enough to counter the force of gravity. This ...


1

You add a constant force by doing pretty much what you're doing already. The problem you're likely having is a debugging one, or your expecting more force to be added then you're actually adding. Keep in mind that if you want the force to affect the object, you'll probably want to apply a larger force when the touch has ended. Remember that how much the ...


-1

All you need is the object to have a velocity. Then, every tick you add your force (gravity) to it's velocity, and add your velocity to it's position.


0

What I would likely do is convert the rectangle to a Pixmap, then, assuming the rectangle has a solid single color border (with a different color than the rest of the rectangle), I would simply iterate through the pixels in the Pixmap looking for the border color and save all the positions to an array. Then all you would have to do is periodically set the ...


5

For 3D, Unity uses PhysX. According to this answer, PhysX uses a symplectic integrator. The paper it cites as evidence is a bit more ambiguous though: Since it is a commercial engine the implementation details are unknown ... Most physics engines provide results similar to the Symplectic Euler integrator, or 2nd order Euler. Novodex (Ageia PhysX) ...


0

If you're looking for a really simplistic approach, here's one I've used in the past: Create an object that has both sub-objects (rectangle and circle) Create a getter/setter pair for x/y coordinates on your object When you move the object by calling setX(x), it sets the rectangle's x coordinate to x, and the circle's x coordinate to x + a where a is the ...


0

assuming by sprite you mean that it is an image (loaded from a bitmap): i would iterate through the pixels in the image, and identify the ones on the edge (adjacent to a transparent pixel) (or load an identical black and white hollow rectangle image showing only the edge points for easier identification) log those Points into an array by starting at one ...


1

Why calculate the trajectory for the sounds/slow down effects? If you split the act of slowing down the camera and playing effects into sections upon approach to your squishy victim then you can essentially play them on condition of their proximity. This is a great example that comes to mind. The proximity slow down effects employed in Peggle The ball ...


2

getBoundsInParent() returns the bounding box around the shape — a rectangle. The built-in intersects() check works only for rectangular shapes, not for circles, polygons, etc. For these, you'd need to implement the check yourself.



Top 50 recent answers are included