AddForce LimitSpeed with acceleration and deceleration?
I've a script on a object that is controlled with sliders. Ive got a maxspeed control slider that controls the speed but when I change the speed down the object responds directly and goes to that speed...
View ArticleAddForce relative to child position and rotation?
Again a question. I was thinking... Is it possible to make the AddForce relative to a child on the object? Like position and rotation? ![alt text][1] I've got the GameObject (Going to name it Motor)...
View ArticleUsing OnTrigger to make two trigger objects open a door in unityscript.
https://www.youtube.com/watch?v=7tT9LahdBW8 Theirs this video displaying how to make a game with Playmaker in order to match colors on separate triggers to end a game. I thought it would be interesting...
View ArticleMy Character teleports instead of smoothly gaining altitude. How do I fix...
I've got this problem where my Character "Bob", Jumps into the air like if he was teleporting. When I press the Jump button he teleports instead of smoothly gaining altitude. I can't figure out why it...
View ArticleForce Help
Hello, I am working on a game with a quad copter and I have 4 forces added to 4 empties that are positioned in the center of each rotor. To move forward, I have the back forces increase. I need to have...
View ArticleConfused about how AddForce works
Hey there, guys! I wanted to check out something with the community, because I can't seem to get why add force works the way it does (I assume it has something with gravity, but it will be way easier...
View ArticleRaycast 2D
Hi, I want to make a thing that if it comes close to a collider it pushes back (This case up). But what do I need to change to get it to work for 2D? using UnityEngine; using System.Collections; public...
View ArticleBullet script not working!!! Pls tell me how to make a bullet script.
using UnityEngine; using System.Collections; public class FP_shooter : MonoBehaviour { public GameObject bullet_prefab; float bulletimpulse = 100000f; public Rigidbody rb; // Use this for...
View Articledetect whether a gameobject has passed through two others,
I am developing a game which consist of three balls. How can I find out if one of them has passed through the two other balls ? The balls are on a 2D screen. I want to call a function after one of them...
View ArticleUse force instead of transform.position
Hello I have a mouse follow script which is use static velocity. But i want to transform it to force physics How can i do it. My Script is ; using UnityEngine; using System.Collections; using...
View ArticleGameObject instances affecting each other
I have a function in a script attached to the player object which fires a cannonball when the player hits space: void Fire() { Object cannonBall = Resources.Load("cannonball"); GameObject shotInstance...
View Articlehow to: Velocity or addForce to 2D (Instantiated?) Object
I'd like any easy script with public GameObject yourObject; or public Rigidbody2D yourObject; to add my prefab which is a GameObject with a sprite renderer, if needed also a Rigidbody2D (Or you have a...
View ArticleShot 2D Projectile in mouse direction always with same speed
Here is my code: m_ShotCopy = Instantiate(m_Shot, transform.position, Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; Rigidbody2D rigidBody = m_ShotCopy.GetComponent(); Vector3 m_ShootDirection;...
View ArticleHow do I flip my player using GetMouseButtonDown
I'm making a 2D games and I know how to make my player walk and flip facing right or left using left and right arrow keys.. But how do I do the same thing using mouse clicking. If i click on the left...
View ArticleA 2D Character Controller with Rigidbody2D.AddForce
I just want to know if it's possible to fashion a 2D character controller where player movement is based on the AddForce method rather than directly editing the velocity of the character's attached...
View ArticleInstantiated Prefab no Rigidbody2D on Update function
Hey there, I have the following situation: I got a GameplayManager script like this: public class GameplayManager : MonoBehaviour { public Transform spawnPoint1; public Rigidbody2D player; void Start()...
View ArticleHow to add a startforce to a rigidbody 2D but let gravity take it from there?
Hi, I'm making a 2D platformer game and now I want to trow a ball. The ball has to collide with everything except my player. So I added a rigidbody 2D and a trigger collider, I also added a child with...
View ArticleSpawning a Ball going forward every 5 seconds error, help!
Alright so I made this script: using UnityEngine; using System.Collections; public class CannonShots : MonoBehaviour { public Transform ballPos; public Rigidbody Ball; public float timeMin = 1; public...
View Article[Unity2D] Firing bullets based on gun orientation
So when the player clicks, it instantiates a bullet prefab as well as gives the rigidbody2D a force. The issue is I don't know what vector2 to use I've tried Vector2.right, any combination of position...
View ArticleHelp with platform jumping game
So i'm making a simple game where you have to land on platforms that propel you in the air. and i'm having trouble getting the platforms to add force correctly. When you touch the first one it does it...
View Article