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

Does Unity correct force applied to objects by gravity with altitude?

As an example, at height of 350 km above sea level gravity is about 90% of what it is on the surface. Is that drop in gravity build-in in physics engine?

View Article


Do I have to add rigidBody even when the movement doesn't use physics?

I heard that adding RigidBody component to a moving object saves some kind of RAM capacity or something. But does it have the effect even when the object's movement is not physical? What I mean by...

View Article


Jump Ability in my first game (2d platformer)

Can anybody tell me why this code isn't working? I don't get any errors, nothing happens when I press space. I am a beginner so please explain your answer. Thanks. Here is my code: public class...

View Article

Increase force/size the longer input has been held down.

So I've got a character who on left click, instantiates and fires a bullet from his gun at a constant force using rigidbody.addforce but now I want to add it so the longer you hold the left click down,...

View Article

Why does my character sometimes jump higher than other times?

When I use this code to let my character jump, it sometimes jump higher than other times. I am making a 2D platformer using System.Collections; using System.Collections.Generic; using UnityEngine;...

View Article


Roll a ball, how to addforce to the ball in an isometric environment ?

Hello, I struggle to set up my character controller script that move a ball by applying forces to the rigidbody in an ISOMETRIC environment. I found many tutorials about how to move a character in an...

View Article

NaN error when adding force to direction of near object

To move my character I use addForce(-100, 0, 0) or addForce(100, 0, 0) I won't explain this just watch this video: http://www.mediafire.com/file/ch8otkq3yqpwcst/VID_20180216_120736.mp4 ![alt text][1]...

View Article

Unity 2D addforce problem

Hello, I am trying to move my character and I assigned AddForce to "d" but it just starts moving then it stops and I need to press key again to start moving. Here is my code: using System.Collections;...

View Article


Stopping a rigidbody immediately

I'm very new to Unity and C#. I have a cube rigidbody that I am trying to stop once I release a movement key(WASD, etc). However, when I release the key the cube slides just a bit and that is what I am...

View Article


addforce from grenade explosion in local coordinates

I thought I had this script perfect...I detect where the grenade has landed in relation to the enemy as far as front of, back of, left or right - then did addforce to blow the enemy in opposite...

View Article

rb.AddForce not working for vector3 left or right

I have an enemy with 4 empty gameObjects as children - one in front, back, and each side. I use those to detect where he is in relation to an explosion so it triggers the appropriate animation and adds...

View Article

Need help applying circular force to an object

I'm working on a project with a group of people that involves putting a lander on a planet (not original I know, but I'm looking for more experience than anything). Anyway we currently have the...

View Article

How to make object land on certain point?,How to make object land on certain...

I am developing the game where I am using planet gravity.When I add force to the object it will fly from one planet to other but sometime the object land upside down at that time force can not be...

View Article


Add force to Rigidbody towards clicked direction using Raycast

Making a billiard game. I want to push the the ball to wards the direction of the mouse click using Raycast. I'm having difficulties finding out how to use Raycasting with add force.

View Article

transform.addforce to stay in local z axis

I'm trying to make a vehicle controller, but I keep running into this problem. Whenever I use transform.AddForce to a vehicle's transform.forward, it will continue to travel in that direction even...

View Article


How can I move with UI buttons without having to press many times?

So i'm trying to move player left and right by pressing UI buttons. (This is the script) : void FixedUpdate() { rb.AddForce(0, 0, forwardforce * Time.deltaTime); if (Input.GetKey("d")) {...

View Article

Diagonal Dash

I've made a movement script that includes dashes, but I can't dash diagonally. Does anyone know how to include this? Any help is appreciated. void Update () { if(DashCD>0){ DashCD -= Time.deltaTime;...

View Article


Diagonal speed too fast with 0.7 multiplier

I worte a dash script and I'm currently trying to add a charged dash attack, EVeryything works fine (up until now). For some reason now my diagonal dashes are too fast, evern though I added a 0.7* (√2)...

View Article

RigidBody2D.AddForce() horizontally is not working!

Hello all, I am having trouble with AddForce horizontally, for some reason my player would be teleporting a set distance instead of actually being "pushed." I have searched the forums and have tried...

View Article

Make instantiated objects do different things.

Hello, I'm making a traffic game, in which when I click the traffic light, the cars will stop, click again and the cars will go again, if any of them hit each other, game over. So far I have had these...

View Article
Browsing all 1264 articles
Browse latest View live


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