Top-down space flight physics - AddForce - Object moves off center the faster...
Hi all, I just started a little project where I want the player to control a ship from a top-down perspective. I want the whole thing to use physics-based movement. My problem is that when I add force...
View ArticleMaking knockback smooth instant of instant
I am working on a simple melee attack mechanic but I noticed that no matter what speed I set the knockback to, it always seems like the character just instantly moves back instead of smoothly doing it....
View ArticleEasy, Add downward force
I have tried coding to add a downward force , please note I have tried many things not just what you currently see, I want on the "t " button press for gameobject to move downward just as the upforce...
View ArticleAddForce not working on instantiated bullets
I'm trying to make a 2D shooter, the ship constantly looks at the mouse cursor and should fire with left click. Right now I have public GameObject bullet // The prefab float nextFire; void Update () {...
View ArticleWhy can't I get ball movement with this script?
I have been trying to figure out how to add an impulse force on the ball with a button press. I can get movement from the ball with the commented out OnMouseDown() method, but I cannot figure out how...
View ArticleAdd Force To One Object in Relation to the Rotation of Another Object (C#)
My player has a GameObject which contains everything (we'll call it 'Player'), a head that rotates with mouse input, and a body that Lerps to align with the y axis of the head's rotation (this also...
View ArticleHow to stop code in the update function?
I have some code that when it executes, it pushes a character forward. The issue is that the character never stops moving and continues forever. Is there a way to stop the character from moving after 2...
View ArticleHow to stop a sphere that is using GetAxis from moving? (Roll-A-Ball Tutorial)
(I just wrote a huge wall of text for like 5 minutes and when I tried to post it, it all was just deleted, so I have to type everything out again, and now it's going to be shorter...) I am on my second...
View ArticleHow can I make rigidbodys treat eachother like hard immovable colliders?
I need movable colliders, that collide with each other and other colliders, but without force. I don't want rigidbodies to be able to push each other around. I mean, really, I don't want them effected...
View ArticleGetAxis being missed in FixedUpdate work around?
I feel like I'm having a colossal brain fart right now, but I can't figure this out. void FixedUpdate() { moveHorizontal = Input.GetAxis("Horizontal"); moveVertical = Input.GetAxis("Vertical"); jump =...
View ArticleUnity 5: AddForce Increases power when already being pushed towards a...
Okay, so I'm kinda new to Unity and all, so yeah. Anyway, I'm trying to make a basic player for something like a 3d platformer. The rigidbody player uses the Horizontal and Vertical keys to move, and...
View ArticleGameObject get launched underneath the terrain when using AddForce
According to my script the car should be launched into the air and when it lands back on the ground it should resume its original track of the navmesh. **Sometimes** when another gameobject collides...
View Articlehow do i move a object with direction of touch
hi , i am very beginner of game developing. i am developing a game where i have a ball and i want to move it by touch just like a soccer game where ball can move by the direction of touch but its move...
View ArticleHow do you add force to a clone after you spawn it?
I want to make a gun, so far it spawns bullets but those bullets travel forward. this is my code `void FixedUpdate() { bulletSpawnPoint = GameObject.Find("BulletSpawnPoint").transform.position; if...
View Articlevelocity to prefab
Instantiating spent casing from pistol when fired that just drops to the ground. I want them to fly out to the right as casings do when ejected. Tried animating the PreFab but the position in the...
View ArticleHow control Rigidbody2d using GetAxis with AddForce and angularVelocity (2D)
So I'm new to unity as well as coding; I've been stuck with this problem for quite a while. I've been using this standard player controller and it works pretty dandy. void FixedUpdate () {...
View ArticleHow to set rigidbody velocity and angularVelocity to Vector3.zero over time?
Hey! I'm currently working on a vehicle system for my game, and when you accelerate, the vehicle's rigidbody adds a thrust force, but when you hit 'S' to brake, it stops inmediatly (I'm setting...
View ArticleAddForce to a randomly selected GameObject with a rigidbody
Hi, I have an array of GameObjects, and one will be randomly chosen to be teleported to a "throwing area". I'm using Unity and my objects are placed behind a background, hidden from any view. My...
View ArticleConstraint an object speed
Hello, I don't want my ball goes at a greater speed as I set in "AddForce()". Is this code correct ? void Update() { if (ball.GetComponent().velocity.magnitude > 250.0f) {...
View ArticlePiles of balloons "tied" to a fixed position - addforce will push them, but...
Hello there I have set up a rigid body and added an Add force to my balloon. It has to look like the is being tied to a table. When I "push" it now, it will just be hit and fly away - how do I make it...
View Article