Rigidbody2D x velocity not moving unless placed in FixedUpdate
Hello! I am having difficulties trying to get an animation event to move my character's Rigidbody2D on the X-axis. If I flip the event to happen on the Y axis, it works just fine. I have tried setting...
View ArticleSometimes the ball passes through the object
- ballForce =210 - Gravity Y = -18 Kind people please help public class GameManager : MonoBehaviour { public Material[] balls; public static GameManager instance; public GameObject ball; public...
View ArticleRigidbody2D stuck on Box Colliders
I have a camera with a box collider and Rigidbody2D (The character). This camera contains the following script: using System.Collections; using System.Collections.Generic; using UnityEngine; public...
View ArticleAddforce.forward on a sphere object
Hi pros, short question. I wanna make a simple beat em up on a small planet. When my player hits an enemy the enemy should fly over the planet. Right now i am moving the enemy after a hit with...
View Articlehow to get a 2d sprite to move towards mouse click smothly?
how do i get this code to make it so that it stops moving on mouse position when clicked public Transform firePoint; public GameObject player; public float bulletForce = 20f; // Update is called once...
View ArticleAddForce to opposite direction
Hello how can i addforce to the opposite direction after using this: `rigidbody_.AddForce(direction.normalized * force * Time.deltaTime, ForceMode.Force);` I tried...
View ArticleCounteract current speed of player
How would I counteract the speed of the player after I stop pressing movement inputs? I need a solution that uses addforce modifying velocity causes lot's of problems for my player controller. ___...
View ArticleHow do I add force to a RigidBody2D?
So I have this scene, where I have a player that can shoot bullets at an enemy. I want to AddForce to the RigidBody2D of the enemy when the bullet hits, but until now I have no success. My bullet...
View ArticleAddForce Jump Doesn't Work
Hello , I don't know why Jump don't work // im new in unity so i need some help Note : walk is good!! using System.Collections; using System.Collections.Generic; using UnityEngine; public class...
View Articleadd a force at an angle 3d
float angle = Random.Range(0, 45) * Mathf.Deg2Rad; rigidbody.AddForce(player.transform.forward * 50 * Mathf.Sin(angle),ForceMode.VelocityChange); I tried this line of code to force a ball at an angle....
View ArticleWhy is ForceMode2D.Impulse working continuously and not suddenly?
Essentially what I'm trying to do is make the enemy "roll' towards the player quickly when it sees it. The raycast is working and it can see the player, but when the force it added its not a quick...
View ArticleHow to addForce even after you release the button?
I'm trying to addForce to the game object. But when I release the button he stops, I wanted him to keep moving even after releasing the button. How do I do? Here is the script: using Photon.Pun; using...
View ArticleAddForce not working on Instantiated prefab
I've been trying to get projectile/prefab bullets in a top down 2d project here's the code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Shooterer :...
View ArticleInputGetMouseButton not working on touch
Hi, i`m trying to make an object(the player) moving upside when i hold my finger on the touchscreen of the phone(Android).I just have a big problem, if i try to use this code : void Update() {...
View ArticleAdd force will push the bullet up
Hi, I am currently making a videogame with a gun. I tryed to apply AddForce to the bullet with the transform.forward from the gun. However, when i shoot the bullet (the gun is vertically positioned)...
View ArticleAddForce to object using OnCollisionEnter via a pre-existing AddForce?
I was making a test game based on a tutorial from a Youtuber named Brackeys on Unity 2019.3.2f1 Personal < DX11 > __ Here's the link to the playlist as to how the entire thing runs:...
View ArticleTrying to follow along a tutorial, but AddForce(ForceMode2D.Impulse) doesnt work
I have tried everything, and it definitly has to do something with ForceMode.Impulse, because a) the Condition triggers, b) ForceMode2D.Force works. using System.Collections; using...
View ArticleAdd force in the direction analog stick in pointing
Hello, I need the the player to have force added in the direction the analog stick in pointing. For example, Move the stick up, force is added forward, move the stick right, force is added to the...
View ArticleHow to get Animator.GetBool to work as a parameter in OnCollisionEnter in...
I have a small amount of coding knowledge but I can't seem to wrap my mind around why this isn't working. Here is the code: public Animator animator; public float forceApplied = 50; private void...
View ArticleRecoil, addforce to one object in the direction from a different object
public class GunShoot : MonoBehaviour { public Rigidbody Bullet; public Transform BulletSpawn; public int damage = 10; public float bulletVelocity = 500f; public ParticleSystem mf; public...
View Article