Jump to content
  • Advertisement

UtMan88

Member
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

104 Neutral

About UtMan88

  • Rank
    Member
  1. Interview with Glu Mobile today!
  2. GDC Days 4-6 - The Conference http://wp.me/pRFp5-9e
  3. A week of vacation, and I feel like a coding fiend :D
  4. UtMan88

    Unity3D C# - Spring Follow Camera

    They told me to try this on the Unity forums too. It only reduced some of the gitching.
  5. // Originally posted here on Unity3D forums So, I've written spring cameras before in other APIs, but I can't seem to wrap my head around Unity's (I'm still fairly new to it). Here is my SpringFollow camera script in C# using UnityEngine; using System.Collections; public class SpringFollow : MonoBehaviour { public Transform Target; public Camera SpringCamera = Camera.mainCamera; public float Stiffness = 1800.0f; public float Damping = 600.0f; public float Mass = 50.0f; public Vector3 DesiredOffset = new Vector3(0.0f, 3.5f, -4.0f); public Vector3 LookAtOffset = new Vector3(0.0f, 3.1f, 0.0f); private Vector3 desiredPosition = Vector3.zero; private Vector3 cameraVelocity = Vector3.zero; // Use this for initialization void Start () { } void FollowUpdate() { Vector3 stretch = SpringCamera.transform.position - desiredPosition; Vector3 force = -Stiffness * stretch - Damping * cameraVelocity; Vector3 acceleration = force / Mass; cameraVelocity += acceleration * Time.deltaTime; SpringCamera.transform.position += cameraVelocity * Time.deltaTime; Matrix4x4 CamMat = new Matrix4x4(); CamMat.SetRow(0, new Vector4(-Target.forward.x, -Target.forward.y, -Target.forward.z)); CamMat.SetRow(1, new Vector4(Target.up.x, Target.up.y, Target.up.z)); Vector3 modRight = Vector3.Cross(CamMat.GetRow(1), CamMat.GetRow(0)); CamMat.SetRow(2, new Vector4(modRight.x, modRight.y, modRight.z)); desiredPosition = Target.position + TransformNormal(DesiredOffset, CamMat); Vector3 lookat = Target.position + TransformNormal(LookAtOffset, CamMat); SpringCamera.transform.LookAt(lookat, Target.up); //SpringCamera.projectionMatrix = Matrix4x4.Perspective(SpringCamera.fieldOfView, SpringCamera.aspect, SpringCamera.near, SpringCamera.far); print("cam = " + SpringCamera.transform.position.ToString()); } // Update is called once per frame void Update () { FollowUpdate(); } Vector3 TransformNormal(Vector3 normal, Matrix4x4 matrix) { Vector3 transformNormal = new Vector3(); Vector3 axisX = new Vector3(matrix.m00, matrix.m01, matrix.m02); Vector3 axisY = new Vector3(matrix.m10, matrix.m11, matrix.m12); Vector3 axisZ = new Vector3(matrix.m20, matrix.m21, matrix.m22); transformNormal.x = Vector3.Dot(normal, axisX); transformNormal.y = Vector3.Dot(normal, axisY); transformNormal.z = Vector3.Dot(normal, axisZ); return transformNormal; } } I originally did this code in XNA a while back, which may be painfully evident with me manually adding in the TransformNormal(Vector3 normal, Matrix4x4 matrix) function. The result I'm getting from this is a camera that's attached to the side of my target and has twitchy behavior. So what am I doing horribly wrong?
  6. Interview with @zeegeegames today. Oh God. So excited. So nervous. I'm spiraling. I'm spiraling! Gaaaahhhhh!!!!
  7. Résumé/CV Added - February 7th, 2011 http://wp.me/pRFp5-7G
  8. Matrix math, how I missed thee.
  9. Thanks @g_shonk and @FSGameDev. Glad to be in the running for most nerdy... I think? Nerd's the bad one, right? HEY! lol
  10. UtMan88

    Bad Jokes

    Man, some of these jokes hurt to read! I heard this a while ago, and I hope no one takes offense. "Liking Java because it's cross-platform is like liking anal sex because it's cross-gender."
  11. UtMan88

    How many of you use C for game programming?

    I learned game programming in C++, and I program in C at work (for database systems). I know C and C++ nowadays are real handy for dealing with hardware and almost kernel-level instructions to do things quickly or to interface with some other module, but personally I never had a reason to use C in game programming. If I wanted to do something quickly (like a CAS, for a bad example) I can call the assembly code inside of C++.
  12. UtMan88

    Theory to a Good Renderer

    OK, if there's at least one thing to pull away from this is to not have scene graphs interact directly with the renderer. Hodgman has a point to use them with physics, and to use them as a per-state object manger would work nice. Also, thanks for all the tips on OpenGL in terms of switching states and such. And good point, Triton, on rendering the sky last! That makes perfect sense. Thanks guys! If anyone else wants to add anything else, feel free!
  13. Thanks @GGJ11 and @IGDAPhilly! I had an amazing weekend and I'm thrilled with the result. Next stop: @GDC
  14. #ggj11. "If we kill all the gnomes, who's gonna make the cookies!?" *panic* "Wait! ELVES make cookies!" *crisis averted"
  15. Must. Complete. Game. Sleep. For. QUITTERS! #GGJ11
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!