Issue#132202: Unity - [SOLVED] Detect what direction character is facing

  • I have a character walking around a sphere with gravity much like a planet. Everything works but when the character goes past the equator of the sphere the camera and gravity get weird and the player eventually falls off.

    I want to rotate the sphere against the character movement so the character is always upright and it feels like the world is moving whenever the player moves. Because I use "A" and "D" to rotate the character I cannot just recycle the character movement script and make the...

    [SOLVED] Detect what direction character is facing

    0 Answers

    Sorry, your answer is too short !

  • Issue#115444: Unity - Detect what direction character is facing

    I have a character walking around a sphere with gravity much like a planet. Everything works but when the character goes past the equator of the sphere the camera and gravity get weird and the player eventually falls off. I want to rotate the sphere against the character movement so the character is always upright and it feels like the world is moving whenever the player moves. Because I use "A" and "D" to rotate the character I cannot just recycle the character movement script and make the... Detect what direction character is facing

  • Issue#313504: Unity - Pushing a Character Controller based on the direction another object is facing

    I'm trying to set up a plant that hits the player and knocks them back if they get too close to it but my script isn't working, not sure why. this is what I have Code (CSharp): using UnityEngine; using System.Collections; public class FyorifAttack : MonoBehaviour {     HarvestableZone hz;     CharacterController pcControl;     private Transform _myTransform;     private Transform _target;       bool sedated = false;    //this is for something to be added later     bool isBusy = false;... Pushing a Character Controller based on the direction another object is facing

  • Issue#554869: Unity - Move character once hes facing the direction of travel

    Hello I have a script which turns and moves the character in the direction of travel like this: Code (CSharp): animation.SetFloat("Forward",0.2f);   Vector3 direction = (target - transform.position).normalized; Vector3 newDir = Vector3.RotateTowards(transform.forward, direction, 3.0f * Time.deltaTime, 0.0F);   transform.rotation = Quaternion.LookRotation(newDir); transform.Translate(direction * Time.deltaTime * walkSpeed, Space.World); But i don't want the character to walk forwards... Move character once hes facing the direction of travel

  • Issue#9390: Unity 5.3.1p2 Light Probe issue: dark spot in the opposite direction of the directional light

    I can't figure out why I get the dark shadow on the opposite side of the directional light. See image. The light probe that is in the shadow of the cube doesn't get that shadow. As soon as the probe moves out of the cubes shadow it does that. What am I missing?

  • Issue#13164: Unity - Help with character animation script? (C#) {SOLVED}

    I'm writing controls for my player animator and I'm trying to write "if A or D is held down, play the walk animation" How would i do this? I've tried using '||' as I've seen it be used for other type of scripting before but i get the error message Operator `||' cannot be applied to operands of type `bool' and `UnityEngine.KeyCode'Click to expand... This is what i tried and didn't work if it will help: Code (CSharp): if (Input.GetKey (KeyCode.D) || (KeyCode.A)) {... Help with character animation script? (C#) {SOLVED}

  • Issue#39919: Unity - [SOLVED]how to detect when mouse is over GUI panel?

    hi how to detect when mouse is over GUI panel? thank you EDIT: I think I found a solution - need to use Event Trigger

  • Issue#62716: Unity - [Solved] Diagonal movement speed issue

    Hello. I am attempting to move my player up, down, left, and right on a 2d plane. However, I was getting what is apparently a common issue where diagonal movement was compounded by 2 different vectors equalling more than 1. The solution, apparently, is to normalize the vectors and then use those normalized vectors to move the object at the end of the function. The problem I am having now is that I can no longer move up or down, it only allows me to move left or right, and I can't figure out... [Solved] Diagonal movement speed issue

  • Issue#69984: Unity - [SOLVED] Detect when Texture has alpha channel

    Hello all! I´m working on each gpu type on Android plaftorm, so I´m using a custom OnPreprocessTexture like this: Code (csharp): class MyTexturePostprocessor extends AssetPostprocessor {         function OnPreprocessTexture () {                   var importer : TextureImporter = assetImporter;               var textformat : TextureImporterFormat;             var textSize : int;                         if ( importer.GetPlatformTextureSettings("Android",textSize,textformat) == false ){... [SOLVED] Detect when Texture has alpha channel

  • Issue#87830: Unity - How to detect a gameobject without colliding?[Solved]

    So i have this basketball game i have setup a very small sphere game object on the rim, when the ball collides to it it will play a sound and the score will increase, the problem is sometimes i doesnt collide with the ball because it's too small, and sometimes when it collides to the ball, the ball will bounce back to it making the score multiply, or the ball comes out of the rim and a score is added, what is the possible way for the rim to detect that the ball entered ? Here's my game... How to detect a gameobject without colliding?[Solved]

  • Issue#116760: Unity - Shoot Bullet in the direction the canon is facing

    Hi, i´ve got a canon that i can rotate around its Z Axis. That Works fine. In the canons center i instantiate a bullet (just a ball). Now how to get the bullet to exactly the same direction like the canon. my Instantiation, where "this" is the canon and "go" is the bullet Code (CSharp): go=Instantiate(Resources.Load("Ball-blau"))asGameObject; go.transform.position=newVector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y,... Shoot Bullet in the direction the canon is facing

  • Issue#192297: Unity - 2D Hookshot Rotation issue with Raycast (Solved)

    Hi! I'm currently working on a 2D game where the hookshot is one of the main gameplay element/mechanic. The grappling will draw the player toward the end point, a bit like link grappling hook. It's working but it is not precise. There is an issue. The line of the raycast does not have the same angle of the line renderer I'm using as a grappling. I've been looking for what's wrong with this code for a while but can't get my head around it. I'm sure it's a stupid little error that is screwing... 2D Hookshot Rotation issue with Raycast (Solved)

  • Issue#195314: Unity - [SOLVED] I'm trying to have one character ride on another, and move around

    So I am stuck with some weird physics behavior. I am working on a new core feature for my game, but the physics don't seem to agree with my attempts. I explain everything in this video. I have attached the relevant scripts for the car and testrider. Please tell if you need more information to help me.

  • Issue#231067: Unity - Rotating the CardboardMain to the direction the head is facing

    So I'm very new to this but I'm getting the hang of it. I'm making a cardboard game with a ps4 controller to walk around. Everything is working until I turn around from the start point. I have the left analogue stick going forward and back working in every direction but the strafing is only working on the first angle. It's not adjusting so it only sticks to one axis regardless of where I'm looking. I think it's because the CardboardMain isn't rotating with the head, which is what I want it... Rotating the CardboardMain to the direction the head is facing

  • Issue#344447: Unity - [Solved] How to detect double tap on ui button.

    Is it possible to detect double click as with guitexture ( input.GetTouch(i).tapcount==2 ) ? Thank you in advance.

  • Issue#358824: Unity - Changing Sprite Depending On Direction It's Facing

    For a 2D Unity game I'm making, the player sprite has different sprites depending on the direction it's facing, so for example when it's moving up, the sprite shows it's back to the camera, then when it's moving down, the sprite is showing it's face towards the direction of the camera, and then when it's moving left and right, it faces those directions respectively. The only thing is, I don't know how to do this. I've got the player movement but not this change of sprite thing that I want.... Changing Sprite Depending On Direction It's Facing

  • Issue#388651: Unity - Character issue

    Greetings, I found a character issue in Unity Editor. So, When I enter a "Ə" or "ə" characters, Unity shows it as "?". But, I found a solution for it. But this is so primitive way. I enter these characters into the notepad and then copy & paste into the Unity Editor (for example: UI Text or something else like this component.). I just want to let you know about this issue. I hope this problem will be solved in the next updates. Thank you for your attention!

  • Issue#444373: Unity - How to make character change direction when it can't move forward?

    The result I am after is that the character can normally push objects around, but when it is pushing an object against a wall, thus not moving at all, it would turn around and walk the other way. Is there a good way of doing that? Right now I'm thinking of actually keeping account of the characters position for the last couple of updates and add up the magnitude of the movement during these updates. Then if the magnitude of movement is below a certain threshold the character would turn... How to make character change direction when it can't move forward?

  • Issue#465766: Unity - Physics objects facing the direction of motion

    So, as the title suggests i'm looking for pointers on how to force a physics object to rotate so that it always faces its direction of motion. For example, when the object is 'fired' it will face in a sideways direction as that is the way it is going. However, as it slows and begins to fall due to gravity, the direction its facing will begin to point downwards as this becomes its new direction of motion. I dont think its quite as complicated as it seems at first because I intend to put... Physics objects facing the direction of motion

  • Issue#509644: Unity - [SOLVED] HLAPI: Error with Sync Transform & Character Controller

    HLAPI, C# I have a server - client connection that spawns a playerPrefab... both client and server playerObject has this attached: As soon as i try to move the character on the client this message gets spammed at the server - There is no movement. (Note that i had the same output by manually moving the character without a CC attached and set to Sync Transform) ServerSide: Code (CSharp):   NullReferenceException: Object reference not set to an... [SOLVED] HLAPI: Error with Sync Transform & Character Controller

  • Issue#515224: Unity - [Solved] How to detect double tap on ui button and change interval.

    Is it possible to detect double click as with guitexture ( input.GetTouch(i).tapcount==2 ) ? Thank you in advance.

  • Issue#545763: Unity - Shoot where my character is facing.

    Hi all!! Im new with this tool and im making a 2d platformer game, where i can make my char shot lasers to where he is looking at. This is the script for him to shoot: -------------------------------------------------------------------------------------------------------------- using UnityEngine; using System.Collections; public class Dispara : MonoBehaviour { public float fireRate = 5; private float timeToFire = 0; Transform Ojos;... Shoot where my character is facing.

  • Issue#585565: Unity - Weird Issue - Solved

    Hi there, this is probably something really stupid am just not seeing but am having a issue. for some reason Back,Left and Down are refusing to register even thou the block rotations are correct I should point out that the blocks are children of another object hence the use of Local rotation. I find it weird that Forward,Right and Up are all working correct. Please help my head hurt. Thanks in advance =) Code (CSharp):         Debug.Log(Block.localRotation.eulerAngles.y);         if... Weird Issue - Solved

  • Issue#590654: Unity - URGENT Mecanim rotation direction issue

    As of 5.3.4p4 and up I'm having this really annoying issue when trying to animate a character. Say I want to create an arm rotation from point A to B in a clockwise direction. In earlier version of unity I just had enter record mode, to add a keyframe at point A, move the playhead to where I want it and rotate the arm clockwise to point and that would work perfectly. In p4 and up, the arm randomly decides to rotate anti-clockwise. So instead of just going from 0 to say 45 degress, it goes in... URGENT Mecanim rotation direction issue

  • Issue#611697: Unity - Rotating player to direction of movement issue

    So I'm trying to make my player rotate toward the direction of movement and it kind of works, except along with rotating along the y axis toward the direction, the player immediately rotates on the x axis laying flat versus being upright. This is the only code I'm using for rotation: Code (CSharp): void Rotation()     {         Vector3 NextDir = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));           if (NextDir != Vector3.zero)         {... Rotating player to direction of movement issue

  • Issue#629722: Unity - [SOLVED] Tackling the issue of spawning non-player objects from non-player objects.

    I plan to have players spawn non-player objects from other non-player objects into the scene. The issue is that non-player objects do not have Client Authority Owners or specific Connection To Client or Connect to Server. Code (CSharp):     private void AddingNewSplitGroup() {         foreach (GameObject obj in this.selectionManager.selectedObjects) {             NetworkIdentity identity = obj.GetComponent<NetworkIdentity>();             Debug.Log("Calling on CmdSplit()");... [SOLVED] Tackling the issue of spawning non-player objects from non-player objects.

  • Issue#658472: Unity - Making the enemy shoot in the direction the player is facing.

    TITLE CORRECTION: Make the projectile the player shoots travel in the direction the player is facing. I have a 3rd person spaceship that I can fly on a 3D space and make it look at the mouse cursor, so it's not necessarily facing the direction in which it is moving (like in Geometry Wars). What I want now is for the ship to shoot in the direction it is facing. At the moment I only know how to use the Vector3.up or Vector3.forward, but these don't take into account the direction the ship is... Making the enemy shoot in the direction the player is facing.

  • Issue#704896: Unity - How to detect direction of player when going to wall

    Hi, I have a simple wall and I have to detect in which direction is player approaching the wall. I dont have to know precise angle or something, just if player is going from right side or left side. How can I compute this please (without using two other triggers)? Thank you

  • Issue#709898: Unity - How to change the direction of a character?

    Hello, I have faced a problem that I dun know how to rotate the character to the right after I pull the joystick to the right I have tried to rotate the character using transform but the character is disapper (or transparent) after I rotated the character 180 degree. Is there any way to deal the above problems at the same time? Thank You

  • Issue#719946: Unity - [Solved] How to control which direction the Dropdown shows the selections?

    In the GIF above, it is split into two tabs, the Scene view tab (above in the GIF) and the Game view tab (below in the GIF). I noticed I cannot get the Dropdown to go down instead of up. Going up means, the selections are up above and out of the camera's view, which is what I don't want. I want it to go down, where it will be inside the camera view. How do you control which direction of the Dropdown menu to show the selections at?