Adding force to rigidbody2d to slide
Hello, I'm having problems adding force to rigidbody2d properly, the effect I want to achieve is to add a forward forward to my rigidbody2d to make it slide forward, sometimes the rigidbody slides,...
View ArticleHave prob with get axis
hi i am new to unity and just trying out some tutorials in scripting i am trying to move a sphere on a plane using this script using UnityEngine; using System.Collections; public class playerctrl :...
View Articlemy rigidbody2D doesn't move on addForce
I want to make a zombie walk. Little force forward wait a little and then again a bit force forward. Here my code: var intervalWalkTime:float = 3; var walkSpeed:float = 10; function Start () {...
View Articlerigidbody.AddForce not relative to rigidbody's rotation.
I have a control system set up for a rigid body character, but the movement isn't relative. How do I make it relative? #pragma strict var MovementSpeed : float; //var JumpHeight : float; private var...
View ArticleHow to disable constant force over time? Rocket game
Hello, I have a rocket prefab with a rigidbody and box collider that needs to collect coins (fuel) in order to keep moving up. I would like the rocket to stop moving up (run out of fuel) if you stop...
View ArticleMovement with AddForce: Wrong Direction
Hey everyone; I have a Player Controller script that is supposed to apply a force to the player GameObject to make it move in a direction based upon user input. public void MoveUpdate () { float h =...
View ArticleAddForce instead of modyfing Velocity
I just realized that if i want to use physics with rigidbodies2d i cant move the player or character by modyfing Rigidbody2D.velocity. So how do i do it? Im getting the movement input from...
View Articlemoving with rigidbody without acceleration
Hello, I was wondering if it is possible to move with rigidbody without acceleration. So the player has 1 consistent speed throughout, that is top speed instantly when it moves. I've looked into...
View Articlerigidbody2D with instant max speed and slow stop
I've been trying to achieve this for longer than I care to admit... Here is my current code: public float maxSpeed = 10f; private Vector2 movement; void Update () { float x_move =...
View Articlethrow object at specific direction or angle
I am trying to throw a gameobject on swipe direction similar to paper toss game i tried Addforce but i cant throw at swipe direction please suggest any solution. bottom line : i want to throw object at...
View ArticleAdd force in the camera direction??
I want to addforce in the direction that the camera is facing. The only problem is that the camera is slightly pointing down. So if I go backwards, the ball starts the float a little. I am currently...
View ArticleWhen to use OnCollisionEnter and OnTriggerStay and how to use rigidbody.AddForce
Hi Sorry for the long question title. I am trying to make a treadmill for a uni project. I want the treadmill/conveyor belt to move the player along its path and if the player tries to move with it...
View ArticleRestrict the velocity added to a rigidbody by player input alone
I am creating a rigidbody controller and i'm have a problem with restricting the velocity the rigidbody can gain from player input alone (ex: pressing WASD). All of the rigidbody controller scripts I...
View ArticleJetPack Joyride - Addforce or velocity?
Hi, as the title suggests I'm trying to build something similar to jetpack joyride using unity 2d tools. I am hoping someone can give me a brief overview of how the coding part of it would work....
View ArticleJump Height Different On Android
I can't figure this out. My force is put in my FixedUpdate() function and yet I'm still jumping 3x as high on android. Is there something I'm doing wrong? using UnityEngine; using System.Collections;...
View ArticleAddForce not working on Rigidbody2D.
I have a floating island that Translates up and down with a Rigidbody2D (Gravity Scale = 0). I'm trying to AddForce it upwards when the Player lands on it but it just floats down with the character....
View ArticleAdding force with a trigger depends on location
I am using a trigger in front of the player to detect for another player. Using the rigidbody I add force if the player punches while another player is in the trigger. When the player is on the edge of...
View ArticleObject doesn't stop moving OnCollisionEnter
Hi! in my script i am instantiating the prefab at random assign spawn, when it instantiate prefab , i addforce to move it toward my player, it works ... on collision i stop creating instantiating, it...
View ArticleWhy doesn't rigidbody2D.AddForce(-5, 2); work?
Assets/Scripts/2DRigid/RigidSwordEnemy.js(54,37): BCE0017: The best overload for the method 'UnityEngine.Rigidbody2D.AddForce(UnityEngine.Vector2)' is not compatible with the argument list '(int, int)'.
View ArticleHow to retrieve the velocity after landing from a jump if the input is correct ?
(It's physics2D) I'm storing the **current velocity** when i jump. When i land it plays an animation, on the first frame of that animation i call an event wich call the function **impulseTimer**. When...
View Article