Quantcast
Channel: Questions in topic: "addforce"
Browsing all 1264 articles
Browse latest View live
↧

How to make arrows fly to user mouse position?

I'm trying to make 2d platformer with bow shooting, but I can't understand how to make arrows fly to user mouse position. With my code arrows randomly fly either to correct point or to right from...

View Article


How to properly move a rigidbody character?

So I've written a rigidbody character movement script which sets the velocity directly... the script is kinda long so I'll just post the crucial part of it Vector2 input = GetInput(); if...

View Article


how do I use a Raycast to apply force to the player on collision (in 2d)?

Hi there! I'd like to thank you for taking the time to read (and hopefully reply ;) ) to my question. So, here's the setup: I have two players that can already run around and jump with ground...

View Article

Increase Rigidbody2D Velocity based on player direction

Hi everyone So I have this script below that determines the players rotation in the direction its heading. How do i add a If mouse down function to addForce to its current trajectory? Any help would be...

View Article

Bullet not moving rigidbody2d,AddForce not working for bullet

Hello, I am currently trying to create a enemy in my space shooter that spins and fires random bullets. My issues is when it fires the bullets the bullets are stuck where they instantiated. I am trying...

View Article


Why AddForce up is higher than AddForce right?

Hi, i want to hit enemy and move the enemy up or right depending on animation and using same force speed, but when i do that addforce up launches far in sky not like addforce right using same force...

View Article

AddForce gradually decreasing

Hi, I'm making a game where the ball jumps on bounceable objects and I accomplish that by adding force on the 2d rigidbody. As it is an infinite runner game, after some time i noticed that ball jumps...

View Article

Rigidbody has zero velocity but still moves

Im trying to slow down a rigidbody attached to something with a configurable joint with addforce. my addforce code works perfectly to stop a lone cube with this code:...

View Article


How to calculate the rb.AddForce for my game?

I want to create a 2d clicker game, where you launch the player forwards to destroy walls. I have two problems right now: I dont know how to calculate the rb.AddForce so, that it always hits the wall...

View Article


How do i move in the direction i'm looking at

I don't know a lot about scripting, all i know is how to do make a simple movement script and a quit game script. I want to move in the direction I'm looking at but i don't know how to do it, can...

View Article

Can an accelerometer be used for a RigidBody based movement?

I have a player object that utilizes RigidBody for jumps and collision. I'd like to use the accelerometer to move the playerobject. I have found success using transform.translate and transform.position...

View Article

How to move forward constantly and right left when it's necessary

Hello, I am developing an endless runner style game, the character will always go forward, there is no problem with this, I can do it as I want with addforce, but it does not go when it needs to go...

View Article

Adding impulse force cancels out gravity force on collisions.

I trying to move my player using AddForce. I don't like the feel of using ForceMode2D.Force because it takes a while for the player to get up to speed and it seems to be constantly accelerating. I want...

View Article


my object dosent move on the platform sometimes

I made an object with ridgedbody2d and addforce It moves well normally but It stop sometimes and sticks on the platform like a gum I checked Input.GetButton("Hrizontal") and the Keyboard is alright...

View Article

Bug With 2D Gun

So I have a gun script the follows the mouse and I add force to the right, but in my character controller script if my player moves left it change the scale from 1 to -1 basically changing where the...

View Article


Jumping cancels out x and z velocity.

So Im working on a movement script. Im using addforce for movement so that I can have acceleration, the only problem is that when I jump, my momentum going forward is reset. The bigger problem is that...

View Article

How can you instantiate a prefab with an initial burst of speed using...

Hi Everyone, As many people who post questions I am new. I'll get straight to the point and say my problem arises when trying to use ForceMode2D.Impulse. Currently in my game I am trying to make a...

View Article


How should I properly fire projectiles and what is wrong with my current...

I created two bullet scripts and two bullet prefabs. I have questions about why each behaves the way they do. My first bullet type uses gravity and moves with .AddForce, while my second bullet called...

View Article

Separate set of movement for when not grounded

Honestly I'm not good at coding, This might be a bit of a weird situation but i essentially want my player character to move in two different ways depending on the conditions. When the player is...

View Article

How to add force based on surrounding colliders in 2D?

Hi there, I am new to programming and forums, if there is a way I can update this to make it easier to read or anything like that please let me know. I have an object in Unity 2D that is surrounded by...

View Article
Browsing all 1264 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>