Torque applied only after force
Trying to control a cube/rigidbody by applying forces to it. While the forces are applied correctly, torque (used to rotate) won't apply when the cube is still. It applies only when the cube is already...
View Article2D AddForce vs. Velocity
I'm doing a 2D platformer, and I'm trying to figure out the best way to control movement. I have addforce and it works relatively well, except when you hold down whatever key, it keeps adding force,...
View Articlerigidbody2D Addforce Problem
Hello, I am currently stuck. I wanted to create a thruster effect with two forces applied to an object. I have two empty gameobjects attached as a child on the bottom right and left side of the parent...
View ArticleAdd force along a path
Hi! I can't seem to figure out a way to push an object along a path using AddForce. My goal is to only limit the players x axis along a spline, and keep the y and z axis free for jumping and going...
View ArticlePhoton - Add force to other player
That's my Gun script for my 2d game, i'm trying to add force to the player hit, but this does not work. if I hit a sprite that has not been instantiated works, it will not work. public class Shotgun :...
View ArticleQuestions regarding jumping
I know this is really easy stuff, but I coudn't find a definitive answer, so I thought I should ask. It's an odd combination but I'm trying to learn how to create a basic character controller, by using...
View ArticleAddTorque() doesn't work when also using AddForce()
Here's my code: function FixedUpdate () { moveTimer -= Time.deltaTime; if(moveTimer < 0.0f) finished = true; if(!finished) { UpdateForce(); UpdateTurning(); } } function UpdateTurning() { var...
View ArticleCircular movement of gameobject with rigidbody
Hello, everybody! I'm trying to make a game, and I need gameobjects with rigidbody to move circular around mouse position in some radius, when player clicks mouse button (like planet's gravity...
View ArticlePlayer Follow Function
Hi Guys, I have Asteriods with rigidbody they have rigidbody.velocity change to something like 0,0,-5 via script. When I want to AddForce It doesnt work. It is just my mistake or I cant addForce when...
View ArticleWhy moving characters laterally with addForce fails?
I am using the following code to move my character laterally: // Get input float move = Input.GetAxis ("Horizontal"); // Set speed Vector2 _velocity = rigidbody2D.velocity; _velocity.x = move *...
View ArticleDashing with rigidbody2D not working right
So I asked a similar question few days ago regarding jumping, and it lead me to an aswer that I'm actually cancelling out my Y velicity with the part of the script that handles rest of the movement....
View ArticleMoving horizontally a rigidbody2d
Hello. I have a doubt regarding rigidbody2d movement. I've seen people using different ways to move a gameobject with rigidbodies: - transform.translate - setting rigidbody.velocity -...
View ArticleAdd a constant force in Unity2D
I have a ball and I want to move it on the X axis, so, in the FixedUpdate method I added a force: `rigidbody2D.AddForce(Vector2.right * speed);` The ball's speed increases because of this code I wrote....
View ArticleNo "AddForce" for Rigidbody
Hi. I started using Unity today and I followed tutorials to get started. i watched basic 10 tutorials for knowing to editor and I am getting to understand it. After that I went to "Project:...
View ArticleAdding force to ragdoll after isKinematic is disabled?
I have an enemy with a basic ragdoll set up. Except instead of instantiating the ragdoll, I just have all the bone colliders on the character at all times and I just set them all to false when its...
View ArticleHow to use AddForce and Velocity together
I have [the jump component who use the AddForce for jumping][1] and [the movement component who move left and right using the Velocity][2]. If you don't move the character when your are jumping the...
View Articleactivate and speed in z axis from a pooled inactive object!!
trying to add speed from a cloned GameObject in the z axis from a pool created at start up. any idea how i would go about that? 1. either add speed at activate in first script or 2. attach a script to...
View Articlefire to camera
Hi a have a cube witch is moving left to right into fixed space. I have a raycast to detect when the cube is in front of my cube and in that point, I need the cube to fire a bullet (prefab sphere) to...
View ArticleCardboard Camera Movement
I am trying to code a space game with Cardboard and want the spaceship to fly where you look instantly. I've been trying with using addForce, which kind of works but when you turn it doesn't create the...
View ArticleCalculate force2d with given time, 2 positions, mass...
For example. I have a cannon. The cannon can rotate up and down to change the force angel. The cannon can shoot balls (with different mass) to a hole (the hole does not change position - it means the...
View Article