Quantcast
Channel: Questions in topic: "addforce"
Browsing index pages (1264 articles)

Using AddForce to reach certain height

Here's my case: I'm writing a rigidbody step system that causes my rigidbody to "hop" onto stairs. Kind of like character controller's stepOffset, but using small hops instead of clipping. How it...

View Article


How to Use AddForce as area effect

I want to trigger AddForce() at collision but as an area effect for example 3 close located enemies I want to apply force to all of them when I hit one of them how can I do that?

View Article


3D slide movement tweaks

I'm trying to implement some slide mechanics in my 3d game. Basically, when the player walks on a slide surface, he will enter the slide state shown below. It kind of works but I would like to make a...

View Article

How to stop a gameObject from pushing a clone of itself?

Hello all, I have a chicken with a box collider and a rigidbody and a script. Its duplicated many times in the scene (it will eventually become a prefab). I have some that can move only horizontally...

View Article

How to add Rigidbody.AddExplosionForce to propel my player?

I am currently trying to make a movement focused game and I want the player to be able to drop bombs and the bombs should propel the player away from the bomb using Rigidbody.AddExplosionForce. But I'm...

View Article


Stopping sky jumping with OnCollision problem

The code seems ok but there is a one problem. when I press spacebar while the player is in air then it falls, the player jumps on the floor even though I did not press the spacebar yet. Can someone...

View Article

Add force in a particular direction

my code... public void ShootBubble() { bubble_obj_current.myRB.AddForce(myCannon.transform.forward * forceAmount , ForceMode.Impulse); } this is not moving the ball in the forward direction of the...

View Article

Calculate force necessary for 2D parabolic shot

Hi all, I'm trying to make a 2D game, where a ball will be launched from a starting position towards the mouse cursor, in a parabolic motion, with the cursor acting as the vertex of the shot. As of...

View Article


Adding a force to a character controller

So, this is my first unity game, and I'm using a character controller for the player. But now I want to add a dash, and I can't find anything on how to make one with a character controller. Is there an...

View Article


rigidbody gets stuck on walls when addforce value is large

I want the object to move faster, so I increase the value in addforce but when the value is high, and if the player keeps the key pressed, the object later gets stuck against a wall during a jump one...

View Article

Different AddForce() Jump Results?

So, I'm using AddForce() to make my player jump. ![alt text][1] [1]: /storage/temp/204375-jumping.png grounded is set to true on OnCollisionEnter() For some reason, whenever I hit space, I get a...

View Article

Is there a formula I can use to calculate force needed to achieve a certain...

Factoring in drag and mass of an object. I'm trying to move my rigidbody player at a certain velocity based on their movement input and a set movespeed. Like, I want the speed of the rigidbody to be...

View Article

Problem with AddForce OnCollisionEnter

In my 2D game, I'm trying to knock back the player when he collides with a specific moving object using the code below. The problem is, once the player enters the collision with that object, the player...

View Article


How to move character relative to camera using AddForce

I get an error: Operator * cannot be applied to operands by type Vector3 and Vector3 `_rb.AddForce(movement * Camera.main.transform.forward * speed * Time.fixedDeltaTime, ForceMode.Impulse);`

View Article

Keep Rigidbody velocity no matter the trajectory.

I have a function that fires a ball in a direction. It gets it's direction depending on the angle between the ball and the mouse position. The issue is that currently if the mouse is further away from...

View Article


Moving a rigidbody object using Addforce, without any overshoot

Hello, I'm trying to create an interaction system similar to the one in Amnesia the dark descent. In the game when you pick up an object it will follow your cursor around while still behaving like a...

View Article

2D Platformer - knockback hindered by player movement

Hey everyone, My problem is that when trying to knock the player back using Impulse AddForce, the player's input overbears the force added. ---------- To better explain the problem, imagine the player...

View Article


Hello guys! I want to slow down the player's speed when i let up my left...

**Here is my code so far** private Rigidbody2D rB; private Vector2 mousePos; private float speed = -10.0f; private bool canSlow; // Start is called before the first frame update void Start() { rB =...

View Article

Rigidbody2D AddForce not working

I know this is a pretty popular question, since i have spend the last hour googling how to fix it. I can't get Addforce to work. I tried it in the game i am making, and it didn't work. Now i have tried...

View Article

How to fix player knockback,How to add Knockback on enemy attack

I want the player to experience knockback when the enemy collides with the player. The Debug.log returns "check", butt the player does not move. There are no unity error's. Can anybody help me out?...

View Article
Browsing index pages (1264 articles)


Latest Images