I need help with click to move
this is my my script first of all: void Update() { if((grounded || !doubleJump) && Input.GetMouseButtonDown(0)) { target = Camera.main.ScreenToWorldPoint (Input.mousePosition); anim.SetBool...
View ArticleBullets falling through the terrain
Hello, I am still fairly new to unity. I am trying to create a 3rd person FPS game, and I looked at some guides on the internet and on Youtube but couldn't find an answer to my issue. My issue right...
View ArticleHow can i make an object move to my aiming position?
Hi! I'm trying to learn about instantiate, and different types of forces, so i'm trying to make a cannon shoot a cannon ball, i've come to this.. It shoots the cannon ball, but i would want that the...
View ArticleUnet: Add a force to hit player (by projectile)
I am trying to add an explosion force to a player object by the projectile that hit him. Any suggestions on how to achieve that? It works for some rigidbodys spawned by Network.Spawn() but not for the...
View ArticleKnockback direction always the same
Whenever my player is attacked by an enemy I want him to be knocked in the direction away from the enemy. Instead he always get's knocked the way he isn't facing. This is the part of the script which...
View ArticleAdd Force isnt working
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "atack") { // the boss dont get this force \/, why? bodyRigid.AddForce(transform.up * 150); bossHealth = bossHealth - 1; PlaySound(0); // damage...
View ArticleWhy is this AddForce Error coming up?
I am trying to complete my enemy animation for the opposite AI to move towards my player but Monodevel keeps popping up with this error message. ---- using UnityEngine; using System.Collections; public...
View ArticleHow to create smooth jump with rigidbody.addforce?
So I am trying to make my character jump with rigidbody.addforce, but it doesn't work. Here is the code(c#): public class Jump2 : MonoBehaviour { public CharacterController controller; public float...
View ArticlePhysics2D AddForce Direction Vector Issue
Hi Unity, I'm trying to code a mechanic where an arrow (which rotates from 0 to 180 degrees and back again forever) points in a direction, and on pressing the space bar fires a ball in the arrow's...
View ArticleSpeed boost ramp
Hi, I'm having a little problem with my boost ramp code.I'm trying to make a ramp like in Sonic, if the player steps in it get launched to the air. My code is VERY simple ('cause the logic is simple, I...
View ArticleChange direction of rigidbody when force is no longer being applied
Hi, I'm creating a basic spaceship style movement system and and am moving the object using AddForce applied to its Rigidbody when a 'thrust' key is held down. The direction of the force is based on...
View Article(2D, C#) Knockback in opposite direction of mouse.
I'm currently attempting to make a simple platform game where you use knockback to move around. However, I'm having trouble getting the knockback to work. What I'm trying to do is to have the player...
View ArticleNewtonian Gravity working backwards
I'm trying to make a planet affect other objects. It kind of resembles artificial planetary gravity, but it is wierd, because the farther the object is, the more force it excerts. Perhaps there is...
View ArticleBullet won't fly forward
Hello, i wrote this script to make my bullet fly: using UnityEngine; using System.Collections; public class HealthShoot : MonoBehaviour { public GameObject BulletPrefab; public GameObject cameraobj;...
View ArticleBullet won't fly forward
Hello, i wrote this script to make my bullet fly: using UnityEngine; using System.Collections; public class HealthShoot : MonoBehaviour { public GameObject BulletPrefab; public GameObject cameraobj;...
View ArticleWhy doesn't my knockback function apply force to it's target?
I'm making a 2-D game, and thought I'd try my hand at a simple knockback script using ForceMode2D and AddForce. The problem is, when my character hit his target, most of the time the force isn't...
View ArticleDefault Animations work but not Custom Animations Movement
Hello, I'm new to this and I've been having a problem with getting my model to move. I've been using an asset called "3rd Person Controller + Fly Mode" and when I substitute my model in, it works fine....
View ArticleAddForce to Object not working [Unity 5]
I have search everywhere for a solution to this problem and so far nothing has worked. My current code is as follows: if (Input.GetMouseButtonDown(0)) { Vector3 correctRotation =...
View ArticleRotate around object then leave at realistic angle
Hi, I'm trying to make a sphere being able to enter and leave an orbit of another object. Currently I am using transform.RotateAround to make the sphere rotate around the object. However, when I stop...
View ArticleAcceleration and Max Speed on 2D Object
Basically I want to control the *acceleration* and *max speed* for an object. The max speed should be constant for all objects of a type, but the acceleration should be different for objects with...
View Article