Using Raycast, add force on the touched point of a gameobject
Hello. what I am trying to accomplish is that i want my gameobject:- a ball, to bounce from the touched point. I mean, it moves upward if i touched it anywhere. If i touched it on the right side, i...
View ArticleUnable to get the flippers functioning.
I am creating this pin ball game where I have troubles enabling the functionality of the flippers. The flippers are exported from 3Ds Max with the pivot aligned to Unity's and are set as rigidbodies; I...
View ArticleDrag to rotate with forces
I want to be able to rotate a planet by dragging on the screen. I am already using a script for this however you have to drag on the object rather than anywhere on the screen. In addition to this I am...
View Articlewhy does my game lags?
Hello Community, got this 2d plataformer, and the character is a vehicule, so Im using addforce to move it. i could swear it was working fine. but I dont know what happened now it lags when I press the...
View Articlehow get velocity from swipe fast or slow speed
hi everybody how get same effect(force added to gameobject) like in android web browser if you swipe screen up slowly screen moves slowy,but if you want to go faster you simply swipe harder. thank you.
View Articlehow do I combine rotation and force from multiple pushing pulling sources
In a 3D world looking from above downwards, objects are being pushed around in a 2D plane by multiple gravity-like sources. For each of the objects, how do I combine rotation and force being generated...
View Articlewhy does my 2d platformer lags?
Hello Community, got this 2d plataformer, and the character is a vehicule, so Im using addforce to move it. i could swear it was working fine. but I dont know what happened now it lags when I press the...
View ArticleHow can I achieve constant Rigidbody2D.AddForce() behavior in the canvas?
I made the mistake of making my bullet hell in the canvas. Now, AddForce() moves objects differently on different screen sizes - which I assume is because the number of pixels per unit is different and...
View ArticleHow to Play a Sound Twice in a Row
I'm currently trying to make a handheld device model that will beep twice when turned on. I have it beeping after a 5 second delay currently after being turned on, however I cannot get it to play the...
View ArticleConfusion with AddForce with ForceMode.Acceleration
In the official documentation, the description for ForceMode.Acceleration is: Add a continuous acceleration to the rigidbody, ignoring its mass. ***Apply the acceleration in each FixedUpdate over a...
View ArticleError AddForce: error CS0117: 'UnityEngine.Gameobject' does not contain a...
using System.Collections; using System.Collections.Generic; using UnityEngine; public class shooting2 : MonoBehaviour { public Rigidbody2D bulletPrefab; public Transform barrelEnd; public float...
View ArticleAchieving consistent jump height regardless of vertical velocity
I keep my player object (Rounded cube, like dice) in steady horizontal motion by directly changing the velocity. cubeRB.velocity = new Vector3(maxVelocity, cubeRB.velocity.y, 0); Vertical velocity is...
View ArticlePhysics2D: how to change angle after collision
Hello world! I am new to unity and horribly stuck with one bit off code. I am building a simple 'block breaker' game that looks a bit like the classic game arkanoid. The game works, but I don't like...
View ArticleDirectional force for Rigidbody's 'AddForce'
Hey there guys, I am having a bit of an issue with the directions of force being produced by a rigidbody. What I am trying to achieve is a realistic gun shooting mechanic. So how this works is, when...
View ArticleTimer & Isgrounded Issue (Getkey not working)
Goal is to have a "Hold Space to jump higher" that cuts out after the timer runs out & can only be initiated if the player was Grounded to begin with. 2 problems I'm having. 1. When using this...
View ArticleWhy does my rigidbody move it's transform while rotating?
The script on my Rigidbody allows the user to change its position and rotate it (through AddForce and AddTorque, respectively). However, when I rotate it, it moves ever so slightly (+/- 1 distance),...
View ArticleAddForce and AddRelativeForce not forcing in the right directions
Hey there guys, I am having an issue with the directions of force being produced by a rigidbody. I am trying to make a gun that shoots a bullet casing out the right of the gun, but when happens is it...
View Articleneed help badly
im practicing unity can anyone show me example c# script of this. i want when i press space 1 time the object will go all the way up and while the object is going up and i press the space again the...
View ArticleBounce the 3d ball opposite to the touched point
I'm trying to create a ball juggling game. I want the ball to move the opposite direction of the touched point. I mean, it should move to northwest if i touched it in southeast part. Right now i can...
View Articleadd Force but in the direction of a gameobject
Hi, i tried to create a helicopter. all fine, apart from the force upwarts. if i use: ... AddForce(0, someValueToTakeOff, 0); the helicopter takes off but straight up. is there a way to make this...
View Article