Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

The latest questions for the topic "independent"

older | 1 | 2 | (Page 3) | 4 | 5 | newer

    0 0

    For a nice effect on a object I constantly change the scale of the transform, but this obviously changes the radius of the SphereCollider too. I need to find a way to keep the SphereCollider's radius the game, even though the scale of the transform changes. Any idea on how to do this? Help will be appreciated

    0 0

    I need to use the unity library, like Network.InitializeServer and networkView.RPC and was wondering if there was a way to do it without the bulk of the 3d engine. I realize that networkView would have to be faked, but is there a way to use the library outside of unity?

    0 0

    I am attempting to make a consistent firing rate. I have done a lot of research on figuring out consistent rates that are independent of framerate and most of the articles about it use deltaTime. However, most timers do not. I have a timer that works as long as the interval is not less that "0.2". Any number less than that has inconsistent results depending on the framerate. Specifically, when I play the project in the maximized window, versus a small window. Here is the code I am using. I know this has been beaten to death, so forgive me, please. I assume I must use some form of deltaTime multiplier somewhere. using UnityEngine; using System.Collections; public class Shooter : MonoBehaviour { // public GameObject bullet; // public Transform cam; public float interval; public float lastFire = -9999; public int shotsFired; void Update () { if(Time.time = lastFire + interval; } } I have toggled out the bullet references so that it can be easily tested. The reason I know it is inconsistent is because I implemented a test that lasts for a specific amount of time. I realize my test may be faulty and could be the actual problem. If so, please let me know. I really appreciate any and all help. Thanks, and God bless! Howey

    0 0

    How do I achieve 'correct' framerate-independent physics in Unity? As I understand it; physics logic should always be performed in the FixedUpdate() function (Application of forces, etc), but does this mean I should *scale* my forces by Time.fixedDeltaTime - similarly to the way we should scale by the [variable] deltaTime in the Update() function for game logic - or is this taken care of by the physics engine its-self? My reasoning for this is; if the number of required physics steps or the fixed update duration changes, then the forces applied will no longer be correct. However if the physics engine already takes this into account, then there is no reason to do the multiplication myself. I've read a few articles on the topic of physics in Unity, however there seems to be a lot of confusion and misinformation out there regarding how to properly achieve framerate-independence - perhaps this thread can clear some of that up? :)

    0 0

    This question is really about how do I create a prefab that allows for this. What I want is a billboard that will always face the camera while it is moving in space. I believe I do this with a gameobject that contains no mesh that has a child gameobject with the billboard mesh. A script I would add to child billboard gameobject would control its orientation to the camera. The parent gameobject would have a script attached that controls its movement. I am having trouble creating the basic prefab with the empty parent and the child with only the billboard in the Unity UI. When I try to drop in the child gameobject it merges rather creating the child. Can someone help me out with the steps to create this kind of a prefab?

    0 0

    Hello people, I've already asked this here a few times, but no one awsered, so let's try again. I've made a Character controller myself, and I tought i did things right when it comes to FPS independency, but when I tessted in other machines, it does'nt seem so. My code is pretty big. but the main lines are these: if(grounded == false) //Gravity for falling {finalmovement.y -= gravity * Time.deltaTime;} if(Input.GetButtonDown("Jump")) //Jumping {finalmovement.y = 7;} myTransform.position += (myTransform.rotation * finalmovement)*Time.deltaTime; //Overall movement I tought it is ok, if my character is not on the ground, the gravity is applied with Time.deltaTime, and if I jump, the Y of finalmovement goes to 7 and then starts to go down with the gravity to make my character move downward. But the problem is, when i have low fps, my character doesn't jump as high. why? It seems that the gravity is being applied more strongly ( I guess its because the Time between frames is bigger ), in other words, my movement is not FPS independent, even if I use Time.deltaTime. How can I solve this? Is my guess about the problem right? Thanks in advance.

    0 0
  • 02/14/14--23:21: List Problem :(
  • > using UnityEngine;> using System.Collections;> [System.Serializable]> public class pl> { public string name; public int> hp,maxhp; public int attack; }>> ________________________> using UnityEngine;> using System.Collections;> using System.Collections.Generic;> public class player : MonoBehaviour {> public pl[] pl; public List pll;>> void Update(){>> } void OnGUI(){> if(GUILayout.Button("TIKLA")){> pll.Add(pl[0]);>> } } }> **> Sorry for very bad english :( When I add list same item.> When I change the name of the last item> Change is happening as I have all of the same item> I want to be independent of the items **

    0 0

    Hello :) I've just done double jump in my game and in a some way it's affected by changing velosity.y by game object. It means the power of second jump depends on a time(?) and changing velosity.y(?) between double clicking "Space". I want to make it independent and the jump's power is need to be the same all the time. Where am I wrong? Thanks in advance! Tomas void Update () { if(Input.GetKeyDown(KeyCode.Space)) { if(grounded) { rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving)); grounded = false; jumpCounter = 1; } else if(!grounded && jumpCounter == 1) { jumpCounter++; rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving)); //Debug.LogError("And second jump"); } } }

    0 0

    I'm creating a game on Iphone/Android. In my game, user plants a tree then have to wait for that tree grow up. Each time user opens game, I check the time when user planted the tree and the current time, then decide the tree is grew up or not. The problem is, if user plants the tree, then change device's time, he/she can cheat to make the tree grow faster. How to avoid this? Is there a way to get the "real world current time" which user can not change?

    0 0

    Hi! I started with unity some weeks ago. Im trying to make a simple side-shooter 2d game, i had set the camera with a script to 1280x720 so i can test it with my phone on landscape orientation. There are a lot of resolutions for android, how should i work around this for not getting sprites scaled or off screen? Thanks :)

    0 0

    With this script it makes the child objects rotate based on the parents position, I want to implement something that will allow me to change the parents scale but not have that affect the child scale. Any ideas how I could implement that into this script ? using UnityEngine; using System.Collections; public class Tutorial_3_Q1 : MonoBehaviour { public Transform _parent; private float eulerAngles; void start() { } void Update() { transform.RotateAround(_parent.position, _parent.rotation.eulerAngles, 50 * Time.deltaTime); print(transform.eulerAngles.x); print(transform.eulerAngles.y); print(transform.eulerAngles.z); } void OnGUI() { GUI.Label(new Rect (10, 10, 200, 20),"Euler Angle x ="+ transform.eulerAngles.x); GUI.Label(new Rect(10, 30, 200, 40), "Euler Angle y ="+ transform.eulerAngles.y); GUI.Label(new Rect(10, 50, 200, 60), "Euler Angle z ="+ transform.eulerAngles.z); } }

    0 0

    Does all of builds will be little endian format regardless of the final build platform? I'd rather not use BitConverter class with: if (BitConverter.IsLittleEndian) Array.Reverse(bytes); If it will be little endian anyway, creating, checking and reversing after is a waste of resources. I already build my custom byte converter class which threats everything as little endian. But the question about multiplatform stays.

    0 0

    I have this code and been messing around with time.deltatime for quite a long time now, not sure why it isnt frame independant, please help. void Update() { Vector3 velocity = bulletSpeed * transform.forward + gravity; //Debug.Log (transform.position); //Debug.Log (velocity); gravity += new Vector3 (0, -9.8f, 0); newPos = velocity * Time.deltaTime + transform.position; direction = newPos - oldPos; float dist = direction.magnitude; if(Physics.Raycast(oldPos,direction,out hit,dist,layersToCheck)) { //Debug.Log("hit Object name: " + hit.collider.gameObject.name); Destroy(gameObject); } else { oldPos = transform.position; transform.position = newPos; }

    0 0

    I know what it does but I'm not sure how to use it in my code All the answers I've found just point to how it's a good way to move or animate when Time.timescale == 0 I need some simple example code I have 2 moving Cubes, I want one to keep moving when game is paused

    0 0

    Hello, I can't get my movement to be framerate independent. Here's the code I using inside Update: void Update () { if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit(); if (Input.anyKey) { velx ++; } else { velx *= drag; } velx = Mathf.Clamp(velx, -max_velx, max_velx); Vector3 delta = new Vector3(velx * Time.deltaTime, 0, 0); transform.Translate(delta); } When I change the quality of the graphics in the game.. the player speed changes considirably. I can't see where the problem might come from, since I'm scaling the velocity by the time spent on the frame.

    0 0

    In my project I have Unity's [CharacterController](http://docs.unity3d.com/Manual/class-CharacterController.html). This is the code that made it move. It's working great when using fixed timestep. vel.x *= friction; vel.z *= friction; vel.x += input.x; vel.z += input.z; cc.Move (vel); I want my game to support unlocked framerate so the character's movement should be updated on per-frame basis. The problem is that the acceleration is really inconsistent. Eventually all framerates hit the maximum speed (they get closer to it every frame), but 1000 FPS reaches it almost instantly, while 15 FPS takes a long time to accelerate. After pondering about it, it makes sense, but I wasn't able to make the acceleration consistent... What is the mathematical solution to this? Any tips are appreciated!

    0 0
  • 03/25/16--04:38: Resolution independence
  • Hi, I have drag mechanic in my game and I want to have same experience in all devices. I've done this before in another game engine and now that Unity gives us Dpi with Screen.DPI, it should be much easier to achieve, but I can't figure it out for the love of the god. My theory is you have to divide the delta movement of touch with Screen.Dpi to normalize the movement and make it same across devices with different screen sizes and dpi's: (touch0.deltaPosition.x / dpi) * SENSITIVITY * Time.deltaTime; But this doesn't work. Would someone please tell me why? I've done extensive search on this but surprisingly nothing much can be found. Thanks in advance and regards.

    0 0

    Jumping and framerate independence. Tried solutions, didn't like. Here is simple example that demonstrates the point - empty scene, attached this to gameobject: using UnityEngine; using System.Collections; public class jumpTest : MonoBehaviour { private float velocityY = 0; private int counter = 0; private float jumpHeight = 0.1f; private Vector3 gravity = new Vector3(0,-.1f,0); // Update is called once per frame void Update () { // gravity framerate independent float gravityY = gravity.y * Time.deltaTime; if (counter == 0) { // Jump is impulse, wont mult jumpHeight // @see http://answers.unity3d.com/questions/1156824/forcemode2dimpulse-do-we-need-timedeltatime.html // velocity framerate independent velocityY += (jumpHeight + gravityY); } else { velocityY += gravityY; } if (velocityY

    0 0

    I keep coming back to this because this is still an issue to me. I switched my focus to other Unity and C# studies but now I'm back. I've seen some videos. Still stuck. Situation: I have a small Terrain and two spheres. I want to give orders to each sphere separately to move to different locations...at the same time though. I want to do it in a "classic" RTS fashion (Ideally, anyway) by left mouse click on unit and then right mouse click on destination. I'm thinking I need a private bool isSelected switch for the left mouse click and then some sort of raycast to mark the destination. But I can't quite figure out exactly how to write this in code. I know how to use raycasting...I can make ALL the units go to a single right-click location, that's easy...I just can't make two units go to separate locations at the same time. I've done all this with physics, without physics, with NavMesh and without NavMesh...all of that. Bummer. I've been spending a lot of time on this but I feel like I'm missing something really basic that's keeping me from accomplishing my task.

    0 0

    I created a script for sinusoidal motion. The movement works perfectly, but the various objects with this script do not move independently. What could I do to solve this problem? Here is the script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Enemy4 : Nave { public float horizontalSpeed; public int yFactor; private float count = 3; private Vector3 s; private bool setPos = false; private float x; private float y; // Use this for initialization void Start () { x = 0; y = 0; s = transform.position; side = Side.defside.ENEMY; } // Update is called once per frame void Update () { y += yFactor * Time.deltaTime; x = Mathf.Sin (Time.time) * horizontalSpeed; transform.position = s + new Vector3 (x,y, 0); } }

older | 1 | 2 | (Page 3) | 4 | 5 | newer