previewtriada.blogg.se

Unity super player controller
Unity super player controller










unity super player controller
  1. UNITY SUPER PLAYER CONTROLLER HOW TO
  2. UNITY SUPER PLAYER CONTROLLER CODE

I just copied the code exactly as you put it in. Transform.Translate(Vector3.up * 5 * Input.GetAxisRaw("Vertical") * ltaTime) Transform.Translate(Vector3.right * 5 * Input.GetAxisRaw("Horizontal") * ltaTime) (Pay attention to how I treat the boolean, very important) var inputEnabled : boolean = false var Character1 : Transform = null Ĭ("Activate") Ĭ("Deactivate") Ĭ("Activate") Ĭ("Deactivate") The code I've written for you obviously isn't capable of that, but it's should be good base to get you going. Plus, it's really flexible! If you use Arrays with your GameManager you could possibly have as many characters as your heart desires. Having a GameManager is really great and will be far more efficient to use than if the characters handled the switching themselves. Instead of attaching this to your characters, make an empty GameObject and call it a GameManager. :) Okay, this may require some changes to your project a bit. Any help would be really appreciated, thanks!Īh, I see you are going for The Cave gameplay style by Double Fine.

UNITY SUPER PLAYER CONTROLLER HOW TO

Also I don't know how to switch back to the previous character controller but pressing the same button. I then have the same script attached to my other controller only replacing 'false' with 'true.' This kinda works but very poorly and with some animation problems.

unity super player controller unity super player controller

Script = GetComponent("PlatformerCharacter2D") Script = GetComponent("Platformer2DUserControl") The method I came up with was to attach a script to each character meaning when I press a button it disables the controller scripts on one character while enabling them on the other. I have two 2D Character Controllers in my game from the unity Sample Assets beta package and I want to be able to switch control from one to the other and back with the press of a button and have the camera focus on the new character. What is the best code to use for moving the ' Player ' GameObject ( 'me') in the game ? What code should I use - There are different options and, I don't understand enough, I'm sorry. Also, what is the best way to change position of character, I want to be constant, so when he runs up a hill, the length of the displacement vector stays constant and, it feels natural.

unity super player controller

My problem is, there are two ways of doing things and, I'm terribly unsure which is the right one. My question is, why not Just do this in void fixedUpdate(), I mean run Input.GetAxis here, so one avoids having to use ltaTime, it seems very silly to waste ones time. So, that was done under void update() so, it had to be corrected by multiplying with ltaTime, which is the time each frame last, so the longer a frame lasts, the more times the movement vector is applied to the object, correcting for frame-rate. I saw another tutorial where I saw some-one use a Transform function to apply a certain movement, along a Vector3, whenever the Input.GetAxis() was active, I assume it works by sending the value of the WSDA direction keys into a Scripted vector and, apply that times a value, to the player. I figured out to use the Debug.Log to show the values in ' variables ' and, during play-testing, I saw in console how Input.GetAxis() gave me sort of a ramp, of values, not just " 1 " when I pressed up and, I know I need to use Input.GetAxisRaw to get that, so I'm very happy with that. I found a tutorial for ' roll a ball ' and, it set up a player-controller, by first making a ball, then adding a physics body ( Rigidbody ), so it reacted to physical stuff and, then applied a force to it, short coding, it worked - But I'm a bit tired, that when I release the button, the ball keeps rolling and, some-how this doesn't feel how you would control a player.












Unity super player controller