Tag Info

New answers tagged

1

How the author specifically got that value was via experimentation. From the comments: Q: Hi James, you set acceleration.y to 460. How did you find this number? Is it static? A: Acceleration was experimentally determined. Its value does not change. And this is often the case when determining values for your game. You pick a value and play-test ...


1

The simplest, modestly realistic, model I can think of would be parameterized by the following: Mz The Turning Moment of the ship about the steering (ie Z or yaw) axis; L/2 The distance of the rudder from the turning axis, approximated as 1/2 the ship's length L; v The current linear velocity of the ship (relative to the water, not the land nearby, ...


0

http://www.rodedev.com/tutorials/gamephysics/ float jumpHeight = 4; //defining the jump height isn't needed. You need only determine the y velocity versus gravity. I suppose that jumpHeight could be the y velocity. You can use trigonometry to determine the jump velocity at a specific angel as shown on the link I provided. Grant you this isn't exactly in xna ...


0

If the rudder turns left /, the boat turns left. If the rudder turns right \, the boat turns right. The more you turn the rudder, the greater the turn the boat takes. This assumes the rudder never turns 90+ degrees. The / and \ assume the boat is facing up ^. ^ | | | | --- / <---rudder


1

Let's say I have three circles. (I'm gonna say circles because if I called them balls, that sentence would sound weird.) What this example is doing is looking if two circles are overlapping. If they overlap, it'll calculate the distance between the two circles, and the required distance based on the radiusses (radii? whatever). It then moves the circles ...


0

I would reccomend removing your box collider and then add it back again. It will automatically resize to fit your texture. It looks like it is a bit off to me. The ground detection looks fine, but both the corner circle colliders are too low. This will cause unrealistic looking collision detection, unless you have reasons for the collider offsets.


0

I would add a slippery physics material then adjust the friction to fit your game. It should fix any hang ups.


0

normalize your normal vector n before using in in the reflect formula. Vector2 n = hit.normal; n.Normalize();


0

What you need is the vector of the shortest distance between the Wall and the balls center. More generally, you seek the distance between a point and a line. Paul Bourke has given a general solution to this well known geometry Problem on his website: This note describes the technique and gives the solution to finding the shortest distance from a point ...


1

The answer is to not have a collide-box on the item/coin itself, but it still needs a rigidbody2D to simulate gravity. We start by finding the objects startposition upon construction. We add a force to it, to push it upwards, to simulate that the item/coin is being 'thrown' out of the dead NPC: startPosY = gameObject.rigidbody2D.transform.position.y; ...


0

You can assign object/prefabs a Tag. by checking specific tag (e.g. 'Coin') to collide with floor and allow only this to be bounced. Quoting Varaquilex above function OnCollisionEnter2D(coll: Collision2D) { { if (coll.gameObject.tag == "Coin") { Debug.Log("Collision occurred for Coin"); } } Of course you may want to tag and check the ...


0

You can probably use layers to apply collisions on certain objects with designated layers. The basic idea is to define a layer for the collision ground and the coins so that coins will only collide with the ground (or the objects in the same layer) and not other objects. Upon collision, you will want to check the layer of the other collision: function ...


0

I found what was wrong, maybe it will help future visitors. This line of code caused problems: rigidbody2D.velocity = new Vector2 (rigidbody2D.velocity.x, verticalInput * jumpForce); While this one did not: rigidbody2D.velocity = new Vector2 (rigidbody2D.velocity.x, jumpForce); The problem was in the input sensitivity for my controls. Sensitivy on an ...


1

I found the answer thanks to this essay Daniel posted. It's something like this (from page 10): desired_velocity = normalize (position - target) * max_speed steering = desired_velocity - velocity


1

Do not put input-updating in FixedUpdate. Probably it's not a full answer, but at least partly your incorrect jumping is because of this: Note also that the Input flags are not reset until "Update()", so its suggested you make all the Input Calls in the Update Loop.


1

Generally with jumping I use Rigidbody2D.AddForce() rather than making changes the velocity. You may find this is a far less painful way of doing jumping and it will still use your Rigidbody (it's also more natural, when you jump you apply force upwards, you don't change your velocity directly). Try swapping out the line for: ...


0

The anchor in HingeJoint2d is the coordinate in local space where the end point of the joint is attached. In order to transform the coordinates to the gun's local space, you should first subtract the center point of the gun from the world position of the mouse, then inversely rotate it by the gun's rotation, and finally inversely scale this by the gun's ...



Top 50 recent answers are included