Unity Community

Page 12 of 22 FirstFirst ... 21011121314 ... LastLast
Results 221 to 240 of 425

  1. Posts
    Hey ArenMook,

    Looks like Unity 3.5 moves the project settings from Library to a folder titled "Project Settings". Might be helpful to update the readme file to indicate this change for future users.

    I am also noticing an error with Unity 3.5. I am getting an "Invalid SceneHandle" error. It states:

    Error in file: C:/BuildAgent/work/b0bcff80449a48aa/Runtime/Camera/UnityScene.cpp at line: 283

    Could you shed some light on this error. It seems to go away once you run the game, but reappears when you go back into the editor.

  2. Location
    Toronto, ON
    @mente: It would be a completely different style of a game. I can maybe see you starting with the arcade example and changing the camera so it's looking at the side of the ship, but to be honest with you I'm not sure how helpful this starter kit would be for you as a 2D scroller game would be a completely different game in its scope.

    @pqumsieh: I've noticed odd issues with 3.5 that are completely on the Unity's side. I've submitted a bug about it a few weeks ago and haven't heard back from them. The error you're getting is inside Unity's C++ source code.
    Last edited by ArenMook; 02-28-2012 at 06:51 PM.
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  3. Posts
    Hey Aren,

    One more question, I was running the profiler taking a look at resource usage and I noticed 90% of resources were being used by something titled "WaitforTargetFPS".

    I tried to figure out what this was doing and where it was located but I had no success. Could you possibly shed some light on this for me please?


  4. Location
    Toronto, ON
    That simply means that the framerate is a lot higher than 60 FPS, and it's capped at 60 due to V-Sync. Another Unity thing.
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  5. Posts
    Hey Aren,

    I am really struggling to use this project with Unity 3.5. I think there are a number of conversion issues; it might be good to make a note of this within the asset store for now until things get sorted out. Hopefully Unity fixes things on their side or you find a way to fix things on your side in the near future. Really liked what you provided, but I think we will have build from scratch.

  6. Location
    Toronto, ON
    Sorry to hear that, and you're right I should mention that Unity guys are working on the fixes. What other issues are you seeing?
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  7. Posts
    I just bought the kit and am pretty much lost trying to use the kit. I have Unity 3.5 and am new to it. Should I be able to select the Welcome Scene and play it or do I need to build with Welcome and Game scenes? It's crashing repeatedly when switching between scenes as well. I have been able to select an opening scene and play it to see how a kit works with other kits... doesn't seem to work in this case.

    I did unzip and copy the library into the library folder, btw - didn't help.

  8. Location
    Toronto, ON
    @WhiteRabbit: The crashing on switching scenes is a bug in 3.5 that has been acknowledged by Unity and passed on to their devs to fix (case 443644). For Unity 3.5 you need to unzip the contents of that zip file into the ProjectSettings folder instead of Library (they changed it in that version). For building, you need to build it with Main and Game scenes selected. For playing, start with the Welcome screen (although you can start with the game scene right away, but it will be single-player only).
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  9. Posts
    Ok, I copied the library zip contents into the ProjectSettings folder and now the Game scene can be played as a standalone. However, trying to play the Welcome Screen scene and clicking on "Host Game" does nothing. The Welcome dialog disappears briefly and pops up again. As an aside, I have the Photon server that I'm using with a non-Unity project and would like to use it within this demo.

  10. Location
    Toronto, ON
    If clicking on Host Game does nothing then it sounds like it's failing to load the scene or start the server. Check your build properties, make sure that the Game scene has been added there. Are you getting any error messages? The game works fine for me when I start it via the Welcome screen on 3.5.0. Switching the scenes in the editor crashes Unity (that's the case 443644 bug I mentioned that Unity has to fix). I also get "Invalid scenehandle" error as soon as the game scene loads. Cryptic, reason unknown. The kit runs perfectly on 3.4.2. 3.5.0 has been far less stable in my experience.
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  11. Posts
    Hey Aren,

    I am starting a new project but want to move over some of your work. I tried to compile the Spaceship, SpaceshipController, and FaceTarget script into a new script called PlayerController. However, the player movement is laggy causing the scene to appear to jitter. I tested to make sure this is the case, I imagine I have done something wrong to cause this.

    I removed the mNavigator and replaced it with generator.powerPercent. I tried to get rid of as much network script as possible and maintain just the basics. Could you take a look at the code and let me know if there is anything apparently wrong with it? I've been trying to figure out the jitters with no luck so far.

    1. using UnityEngine;
    2. using System.Collections;
    4. [RequireComponent(typeof(Rigidbody))]
    5. public class PlayerController : MonoBehaviour
    6. {
    7.     public PowerGenerator generator     = null;
    8.     public float maximumSpeed           = 150f;
    9.     public float mainThruster           = 1f;
    10.     public float maneuveringThrusters   = 1f;
    11.     public float turnThrusters          = 1f;
    12.     public float rotationSpeed          = 5f;
    13.     public float inertiaDampeners       = 0.15f;
    14.     public float boost                  = 2.0f;
    16.     Rigidbody mRb = null;
    17.     Transform mTrans = null;
    18.     Quaternion mCurrentRot;
    19.     public bool movement = true;
    20.     Quaternion rot; // INFO: Used in FaceTarget script
    22.     public Transform target;    // INFO: Used to force the player to face the selected target
    24.     float mAppliedThrust    = 0f;   // Amount of thrust currently applied in any direction
    25.     //float mVelocity       = 0f;  // INFO: mVelocity was used by currentSpeed to display the current speed of the player on the HUD
    27.     Vector3 mMove       = Vector3.zero;
    28.     Vector3 mSmoothMove = Vector3.zero;
    30.     /// <summary>
    31.     /// Relative -1 to 1 range movement input.
    32.     /// </summary>
    33.     public Vector3 moveInput { get { return mMove; } set { mMove = value; } }
    35.     // Use this for initialization
    36.     void Start ()
    37.     {
    38.         mRb = rigidbody;
    39.         mTrans = transform;
    41.         if (generator == null)
    42.         {
    43.             generator = GetComponentInChildren<PowerGenerator>();
    44.         }
    45.     }
    47.     // INFO: FixedUpdate runs the player movement script
    48.     void FixedUpdate()
    49.     {
    50.         // TODO: Add in PlayerMovement here
    51.         PlayerMovement();
    52.     }
    54.     // INFO: Control input is handled within Update
    55.     void Update()
    56.     {
    57.         Vector3 move = this.moveInput;
    59.         if (movement)
    60.         {
    61.             move.x = Input.GetAxis("Roll");
    62.             move.y = Input.GetAxis("Up");
    63.             move.z = Input.GetAxis("Forward");
    64.         }
    66.         // Ensure the vector is unit length
    67.         float mag = move.magnitude;
    68.         if (mag > 1f) move *= 1.0f / mag;
    70.         // Set the ship's values
    71.         this.moveInput = move;
    73.         // INFO: Makes the player face the central enemy structure, smoothly handles rotations
    75.         if (target != null)
    76.             {
    77.                 Vector3 dir = target.position - mTrans.position;
    78.                 float size = dir.magnitude;
    80.             if (size > 0.001f)
    81.             {
    82.                 dir *= 1f / size;
    84.                 if ((Input.GetAxis("Roll") != 0.00) || (Input.GetAxis("Up") != 0.00) || (Input.GetAxis("Forward") != 0.00))
    85.                 {
    86.                     rot = Quaternion.LookRotation(dir, transform.up);
    87.                 }
    88.                 else
    89.                 {
    90.                     rot = Quaternion.LookRotation(dir);
    91.                 }
    93.                 mTrans.rotation = (rotationSpeed > 0f) ? Quaternion.Slerp(mTrans.rotation, rot, Time.deltaTime * rotationSpeed) : rot;
    94.             }
    96.             rigidbody.constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
    97.             }
    98.     }
    100.     void LateUpdate()
    101.     {
    102.         // INFO: Tries to smooth the force applied to the player, refer to PlayerMovement;
    103.         //       I use it in mAppliedThrust to determine the amount of thrust applied to the player.
    104.         mSmoothMove = Vector3.Lerp(mSmoothMove, mMove, Mathf.Clamp01(Time.deltaTime * 10f));
    105.     }
    107.     // INFO: Handles the forces that get applied to the player
    108.     void PlayerMovement()
    109.     {
    110.         // Ensure that we are not traveling faster than we are allowed to
    111.         Vector3 vel = mRb.velocity;
    113.         // 3600 seconds in an hour, but 1000 meters in a km, 3600/1000=3.6
    114.         float speed = vel.magnitude * 3.6f;
    116.         if (speed > maximumSpeed)
    117.         {
    118.             vel *= maximumSpeed / speed;
    119.             mRb.velocity = vel;
    120.         }
    122.         // Amount of thrust being applied right now - mSmoothMove = Vector3
    123.         // DONE: Multiply mSmoothMove.magnitutde by the current percent within the power generator
    124.         mAppliedThrust = mSmoothMove.magnitude * generator.powerPercent;
    126.         // No point in doing these calculations if the engine is idle
    127.         if (mAppliedThrust > 0.001f)
    128.         {
    129.             // Object's current local velocity
    130.             // Not sure why he is inversing the GObjects rotation and multiplying it by its velocity
    131.             vel = Quaternion.Inverse(mTrans.rotation) * vel;
    132.             float factor = 1000f * Time.deltaTime * mRb.mass;
    133.             float dampenerPower = (generator != null) ? (0.25f + 0.75f * generator.effectiveness) * inertiaDampeners : 0f;
    135.             // mMove = Vector3
    136.             // INFO: Manually modifying each individual value within mMove and applying it later into appliedForce
    137.             // TODO: Play around with the controls scheme; ensure we are using forward, right, up correctly
    138.             float forward = mMove.z * mainThruster;
    139.             float right = mMove.x * maneuveringThrusters * 0.25f;
    140.             float up = mMove.y * maneuveringThrusters * 0.25f;
    142.             // Calculate the force we want to apply to the ship
    143.             Vector3 appliedForce = new Vector3(right, up, forward);
    145.             // Normalized direction of the applied force
    146.             float mag = appliedForce.magnitude;
    147.             // INFO: Force direction = either appliedForce * (1.0f / mag) or Vector3.forward
    148.             Vector3 forceDirection = (mag > 0.001f) ? appliedForce * (1.0f / mag) : Vector3.forward;
    150.             // Applied force should take the current engine's power into account
    151.             appliedForce *= generator.powerPercent;
    153.             // This is how much of velocity is currently what we need it to be:
    154.             // Q: What does this do?
    155.             Vector3 compatible = Vector3.Project(vel, forceDirection);
    157.             // Dampener power depends on inertia dampeners strength as well as the current speed
    158.             dampenerPower *= 0.15f * speed / maximumSpeed;
    160.             // This is the incompatible velocity (for side dampeners)
    161.             Vector3 dampeningForce = (compatible - vel) * dampenerPower;
    163.             // If we're traveling in the opposite direction, we want to slow down first (in addition to the engine's force)
    164.             float dot = Vector3.Dot(vel, forceDirection);
    165.             if (dot < 0f) dampeningForce += vel * (dot * 0.1f * dampenerPower);
    167.             // Apply the force and the incompatible velocity together
    168.             mRb.AddRelativeForce((dampeningForce + appliedForce) * factor);
    170.             if(generator.powerPercent > 0.8f && Input.GetKey (KeyCode.Space) && Input.GetAxis("Forward") != 0)
    171.             {
    172.                 mRb.AddRelativeForce((dampeningForce + appliedForce) * factor * boost);
    174.                 generator.DrainPower(10);
    176.                 Debug.Log ("MORE POWER TO FORWARD THRUSTERS SCOTTY!");
    177.             }
    178.             Debug.Log (generator.powerPercent);
    179.         }
    180.         //INFO: mVelocity was used by currentSpeed to display the current speed of the player on the HUD
    181.         //mVelocity = Mathf.RoundToInt(mRb.velocity.magnitude * 3.6f);
    182.     }
    183. }


  12. Location
    Toronto, ON
    Jitters are caused by the camera moving in Update while the ship is moved in FixedUpdate (physics). I fixed it in the space game by adding a LagPosition script in-between of the two. It smooths out the jaggies, making them invisible.
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  13. Posts
    Thanks for the reply Aren, I think we fixed the issue. I really appreciate your quick feedback and help; I've passed the word on about your starter kit as a thanks.


  14. Posts

    Could you further explain how you implement LagPosition? Where is it called? I see that you use ChaseCamera to handle this movement.


  15. Location
    Toronto, ON
    Simple hierarchy of 3 game objects:

    - Rigidbody
    --- LagPosition
    ------ Camera
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  16. Posts
    The camera is a child of the player, I have attached lagPosition and LagRotation to the camera. Is there a step I am missing? It still jitters at this point. I also do not have your update manager incorporated but by looking at the script it doesn't seem to be referenced within lagposition/rotation.

    Last edited by pqumsieh; 03-02-2012 at 01:08 PM.

  17. Location
    Toronto, ON
    Chase camera simply chases a target, and I believe it has similar code to lag position. LagPosition is just more flexible and more generic. (can't look at the code right now)
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  18. Posts
    Just got back to this - Open the project, double-click on welcome screen - always crashes now, so can't add the scene to the build through the Add Current button. 3.5.0 has been out for quite a while - when are they planning to fix this? is it necessary to build the project or can the welcome scene simply be played? I don't really understand the difference between playing a scene and doing a build - the documentation for Unity isn't the best.

    At this point, I've payed $60 for nothing, since it's not usable in its present form and I was hoping to use the starter kit to begin to learn Unity. Will probably have to start over from scratch on the project and hope I can get back to being able to load the welcome scene. Is 3.4.2 still available and, if so, what are the differences?

  19. Location
    Toronto, ON
    Unity 3.5.1 RC1 is currently out for testing, I'm hoping it addressed this issue but I haven't had a chance to test. 3.4.2 is much more stable than 3.5.0, if you can grab it and use it, I would suggest you do so. None of the features they added relate to the space game kit at all, so from my perspective 3.5.0 was just a step back rather than forward.
    NGUI Resources: Documentation | Forum | Release Notes
    Want to get notified when NGUI gets updated? Subscribe to this thread.

  20. Posts
    No luck in trying to find 3.4.2. Clicking on its link takes me to the 3.5 download page.

    After reloading the project, build options include all 3 scenes -- all grayed out and uncheckable. It's crashing every time that I double-click on the Welcome scene.

    So -- the kit is unusable as is with 3.5.0, 3.4.2 seems to be unavailable and the status of 3.5.1 is unknown. My earlier question remains as to whether I should be able to run the kit without compiling by playing the Welcome scene. If I have to compile, how do I do so when all scenes are unselectable in the build dialog?

    If 3.5.1 RC1 is out -- how does one get a hold of it?

Page 12 of 22 FirstFirst ... 21011121314 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts