Quantcast
Channel: Questions in topic: "addforce"
Browsing all 1264 articles
Browse latest View live

Adding player velocity to addforce for instantiated gameobject

My character currently throws a grenade forward, void SpawnGrenade() { GameObject go = (GameObject)Instantiate(grenade, myTransform.TransformPoint(0.2f, 0.5f, 0), myTransform.rotation);...

View Article


Confused about addForce behavior on 3D objects w/ sub-objects in 2D movement

When I apply a force to my object equipped with other objects in the forward direction, it works fine. But when I go in the reverse direction, it eventually turns around on its own. How do I stop this?...

View Article


[2D] Can't AddForce to x but y works fine.

Hey guys. Noob problems incoming :D So I'm working on this 2D Game and wanted to add something like a sliding-movement. Played Titanfall 2 recently and yeah... ^^ I'm stuck at the basic functionality....

View Article

AddForce in Coroutine

Hi, I am developing a game for Android and iOS in which the player taps the screen to gradually move left or right to avoid falling. I decided to implement this requirement with a coroutine that, when...

View Article

addforce to rigidbody when hit

Hi, I want to add force to the player rigidbody backwards. So if a creature hits me i get thrown backwards a couple of meters. I got this: if (hit.rigidbody) { if (GetComponent().Throw == true) {...

View Article


RigidBody.AddForce not working

Hi there! I'm using AddForce to make the character dash forward when the space key is pressed. But when I press the space key the player won't move at all. Does anyone know how to fix the problem?...

View Article

Sphere behaves strange by jumping on diagonal Plattforms or at terrain

Hey, im using this code: public int lifepoints; public float speed; public float jumpheight; private float h; private Rigidbody rb; public bool grounded; void Start () { rb = GetComponent(); }...

View Article

Collision Detection only runs one time

My script sends the ball back and forth in a game of pong, sometimes-maybe-kind-of. void OnCollisionEnter(Collision col){ switch (col.gameObject.tag) { case "Player1": print ("Collision 1"); thrust1 +=...

View Article


Vector3 Help - Calculating velocity toward a point

I'm building a game with freefall mechanics as an integral part of it, leveraging Unity's physics engine. I'm stumped on how to solve for getting a velocity toward a particular Vector3 point. As in, if...

View Article


Knock Back in 3D only works for Y axis

I'm learning unity and for my first try I want to make a game in which there are boulders that can kill the player on contact. I have set my avatar with a RigidBody and capsuleCollider. The boulder is...

View Article

my player won´t jump diagonally but instead it jumps first on the x axis and...

I'm trying to make my character jump diagonally but it's jumping like ultra fast on the x axis and then slowly on the y axis. I'm new to unity and i'm using unity 2D physics. This is the code of the...

View Article

AddForce to camera direction

Ok all i want to do is add a force relative to the camera (forward) (left) (right) (back) but all i can get is for them to move in those directions not relative to the camera using...

View Article

Making knockback smooth instant of instant

I am working on a simple melee attack mechanic but I noticed that no matter what speed I set the knockback to, it always seems like the character just instantly moves back instead of smoothly doing it....

View Article


transform.localPosition vs rb2d.AddForce

I was wondering what is the best practice for moving a game object. Should you use a vector and add a force to the object, or move the object by changing the transform.localPosition value. Adding a...

View Article

Move 3D Cubes with mouse

Hi I have a grid based game, and I want to be able to click and drag one cube in direction left to right. If there are other cubes on the same row, then those cubes will be dragged with it. It would...

View Article


How to slide when i change direction of my 2dcharacter

I want that my character slide a little before i change direction how can i solve that? i tried also with AddForce() but i read that is better to use velocity for character controller and i'm a noob so...

View Article

Push an object opposite direction of mouse position

I'm new to Unity and want to make a game where the player moves by clicking somewhere, and the player object gets pushed in the opposite direction. It's a 3D game but from a top down perspective. This...

View Article


Trying to work with Addforce to move my character

so, following "this and that" i achieved something close to what i want. But there's one thing happening which i don't understand why. My character is moving around as it should, but when it collides...

View Article

Getting launch angle for projectile given height, distance and speed in 3D

I am trying to calculate the launch velocity of a ball that needs to land at a certain position in 3D space. I know the height the ball will be launched from, the position it needs to land and the...

View Article

Hi i am using the latest version of unity and it does not contain a...

How shall i use addforce to move a object if it is not recognised in my system

View Article
Browsing all 1264 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>