Unity 2D addforce problem
Hello, I am trying to move my character and I assigned AddForce to "d" but it just starts moving then it stops and I need to press key again to start moving. Here is my code: using System.Collections;...
View ArticleStopping a rigidbody immediately
I'm very new to Unity and C#. I have a cube rigidbody that I am trying to stop once I release a movement key(WASD, etc). However, when I release the key the cube slides just a bit and that is what I am...
View Articleaddforce from grenade explosion in local coordinates
I thought I had this script perfect...I detect where the grenade has landed in relation to the enemy as far as front of, back of, left or right - then did addforce to blow the enemy in opposite...
View Articlerb.AddForce not working for vector3 left or right
I have an enemy with 4 empty gameObjects as children - one in front, back, and each side. I use those to detect where he is in relation to an explosion so it triggers the appropriate animation and adds...
View ArticleNeed help applying circular force to an object
I'm working on a project with a group of people that involves putting a lander on a planet (not original I know, but I'm looking for more experience than anything). Anyway we currently have the...
View ArticleHow to make object land on certain point?,How to make object land on certain...
I am developing the game where I am using planet gravity.When I add force to the object it will fly from one planet to other but sometime the object land upside down at that time force can not be...
View ArticleAdd force to Rigidbody towards clicked direction using Raycast
Making a billiard game. I want to push the the ball to wards the direction of the mouse click using Raycast. I'm having difficulties finding out how to use Raycasting with add force.
View ArticleProblem reading/getting from rb.velocity value?
Hi everyone, I am trying to give a particular object a boost of force on Y, when its own velocity if over a certain Y velocity. So imagine a Mario 1 style game, if the mushroom was moving over the...
View ArticleTrying to move an instantiated object with a Rigidbody2D and AddForce
I am setting up a gameobject that uses a coroutine to endlessly spawn bullets, and I want to make it so that when I rotate the gameobject it also changes the direction the bullets are spawning and...
View ArticleHow to move a cube constantly with GetKeyDown
Hello! I need to be able to press "A" and the cube will keep moving to the left until it hits a wall. I've tried to do this by using Rigidbody.AddForce, but what happens is it isn't constant then, and...
View ArticleAwake() being called before Instantiate()?
So atm I am going through a course on Udemy. In one Example we create a small boss fight in where a turret shoots cannonballs at the player. The cannonball is a prefab which has force added to it on...
View ArticleAdding force in the direction of the mouse
Hi, I'm making a 2.5D game where you can click anywhere on the screen and it will propel your character in that direction and your aim is to not hit the red box. So I'm trying to add force in the...
View ArticleHow do I slide a cube forwards?
Apparently, using transform.Translate actually teleports the object rather than moving it, so I've been trying to use AddForce to move a cube around, but it seems to be flipping itself forwards rather...
View Articlerb.AddForce problem
Hello! I am trying to get an obstacle to fly through the air (2D) with rb.AddForce, but it takes a little bit to get to full speed. How do I make it to where when the obstacle spawns, it has a constant...
View Articlerb.AddForce-transform.right.. looks like teleporting how to fix??
hello im making a 3d platformer shooter game and i want to add force when my player is hit but the addforce doesn't work the way i want it to work i want it to be smooth not like teleporting and i want...
View ArticleHow to throw an object in 2d
Hello friends, I need help creating a script that allows you to throw a GameObject but not follow it until you release the mouse or with touch input, release your finger. I created a nice little gif to...
View Articleslow down addforce
Hi im trying to make knockback from addforce but its looks like if the bullet hits the player its teleporting so how can i slow down my addforce here is my addforce script: public float speed = 3;...
View ArticleInsure that the player can't increase speed when over the speed limit
**We're working with a space shuttle in zero-G that can only thrust forward.** How do I go about insuring that the player can't just accelerate infinitly but instead can only thrust up to a certain top...
View ArticleUnity AddForce Problem (not a bug problem, but a math problem)
Sorry for the lack of details in the title, the reason for that is that I don't know a short way of how to explain the problem I want to solve. Here's some context: I'm making a 3D platformer game...
View ArticleHow to use AddForce and AddTorque to steer my plane through checkpoints?
So I'm making a flight simulator sort of thing but instead of using input from the keyboard I'm trying to make it run on autopilot and fly through checkpoints that I set. I want it to follow the laws...
View Article