How can I apply a force to an object in the opposite direction of the object...
I'm trying to code an object in my project to fly back when it collides with a wall. However, when I try to apply this force to my object's rigidbody, I get all sorts of errors. Can someone help me...
View ArticleProblem with changing value in coroutine
Hi, It's my first time here and well... it's my first game, so I'm absolute beginner. I'm trying to create Wind Trap. My player (ball), when he will be in range of wind trap should be pushed. I want my...
View ArticleUse addForce to Jump
It's my code void FixedUpdate(){ if (Input.GetKey (KeyCode.Space)) { GetComponent ().AddForce (new vector2(0,5) ); } } But it's not working
View Articlei want to make an animation throw code
hi , im new to unity (3 months) and i m making a remake of a level of an old game namaed"pepsi-man" so i have done all stuf animations of the player , the obstacles but the movement of the can , i...
View ArticleHow do change force when pressing1 key then pressing another at the same time.
Hey Guys i want to simulate a simple thrust like effect for example (Lunar Land). i want to thrust up when pressing up arrow key then thrust left/right when pressing the appropriate arrow key but still...
View ArticleEllo~ I need help with transform.parent = null; When I play it and press the...
if( Input.GetButtonDown("DropWeapon")) { transform.parent = null; glockrb.AddForce(-transform.forward * 520); glockrb.useGravity = true; }
View ArticleControllable ball is ricocheting off mesh collider at high speeds.
Hey guys. I have a ball that is controllable using AddForceAtPosition. That part works fine. However, if the ball is still moving forward, with or without a key press, and the ball is in a hole (hole...
View ArticleAddForce() always throws towards the ground
I have a small test scene with a single model prefab and a single script applied to that prefab. In my scene the model picks up and throws a ball. No matter how I modify AddForce the ball never throws...
View ArticleAdd Force if GameObject is detected in a Polygon Collider 2D
Let's say that I have a Player, and my player can walk, run, and jump. Also, my player has a Polygon Collider 2D and if 2D GameObjects( with a Rigidbody2D and Box Collider 2D) are detected in the...
View Articleraycasthit.normal sometimes returns zero
Hello, so here is my story, my "player" shoots a blast, the "blast" object has a trigger and when it is shot and hits an object with tag "enemy", it adds a force to the object relative to the normal of...
View ArticleHow to prevent stacking addforce/ accumulative addforce
In my project I have the player able to jump and wall jump which both add force upwards as intended, but when the player is against a suitable wall and is able to jump, multiple add forces propel the...
View Articledepois de compilado a força do "addforce" muda!// after compiling the...
eu criei um game 2D, porém depois de compilado os objetos onde eu apliquei "addforce" ficam mais rápidos que o normal. alguém sabe oque pode ser? I created a 2D game, but after compiling the objects...
View ArticleSphere Rigidbody visual oddities when moving at fast speeds & distances
When testing my Unity game on Xbox One I am getting a very large amount of visual "jitter" from the ball. This is a skeeball game where you control the movement of the ball. Essentially the core of the...
View Articlehow can i put a aerial dashing script on my game?
I've started a jetpack game platformer game that allows the player to dash towards left,right,front,back (like a knock back effect). But i dont know where to start nor what functions do i use. The best...
View ArticleKnockback/Push back on Enemy by attack won't work correctly
Hey everyone, I'm trying to solve this issue since nearly 6hours without any success.. I hope someone can help me, I tried to use AddForce on a GameObject (Enemy) to push it back by hitting it, the...
View ArticleNeed help on my script to calculate gravity for a mass
Hello, I'm trying to make a 2D simulation game of planets with gravity that will let you place planets. I've made a script that will add gravity to every object in the scene but it requires the main...
View ArticleInstantiating bullet and moving forward with rigidbody
Hello i have a script for the players shooting, the original script works fine (script 1). But when i try to add a bullet spread i rotate it with a random value on the y axis but it doesnt rotate and...
View ArticleAdding a force offset to center of mass does not cause rotation.
I am trying to make an object rotate by applying relative force to it, but it does not rotate at all. My object looks like this: --[ ]-- in the XY plane. The [ ] indicate the "main body" and the --...
View ArticleAdd force only on local space
Hello, people! I really don't understand! void FixedUpdate () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); Vector3 movement = new Vector3...
View Article