• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By ThunderTwonk
      Hello everyone, I am working on a game idea and since I am still in the process of learning C# and the features available in unity I was hoping some of you might be able to offer me a little insight on things in general for getting started.
      I guess the basic components of what I'm wanting to create would be a Multi-levels management/city builder/rpg.
      The goal is to provide a framework for players to interact with, build in and affect the world both from a 3rd person action RPG as well as a zoomed out 4x style view (This would be something unlocked through gameplay)
      As for my questions go I was wondering if anyone had resources that could help me learn.  I've been on youtube as well as enrolled in an online course for basic unity and C# and will continue those but if anyone has any words of advice, a place that has good information and tutorials etc.
      Thanks for your time.
    • By Cahit Karahan

      Hi, I'm new in this forum. It is honorable to see such communities exist. I would like to share my new game. I did for android with unity. I know the game is a little awkward , but you have to know that this game is from the time when Unity's name is Unity3D  I have made my first game when I was 12. Now I am 22.  I have taken a lot of experience in this process and I can make better games nowadays. I have published this game nowadays but actually this game is very old but also it is very special for me :))
      I have just wanted to retouch and share this game, because it has a very important place for me.

      It's a special free 3D horror adventure action game for the halloween. Fun with scary sound effects and musics, 3D realistic graphics, you will feel the horror in the deep of your heart. Use your reflex. Totally free adventure. Totally scary horror game. 

      Tamarra, she is a beast from our world. She needs to consume souls from innocent people to stay alive. Story begins, the old Elaris tribe had lost their everything because of this beast who lived in the well. Araknas was the most powerful warrior of the tribe. One day, Araknas's mother was killed by the servant beasts of Tamarra. That's how Araknas's journey to the well begins. Tamara's well is guarded by horrible beasts. Araknas has to pass all servant beasts until he reaches Tamarra.

      Even death at the end is worth the revenge. 
      Are you brave enough to jump into Tamarra's well?

      Survive from witch attacks, clown attacks and many scary creature.

      - Realistic 3D graphics.
      - Scary sounds.
      - Scary musics.
      - Best experience with headphones.
      - A demon cage where you can imprison all the demons one by one
      - The witches do not like help, but they love blood stone. Witch store where you can develop your abilities and get new abilities.
      - Countless beasts.
      - At the end of the well there is a hidden surprise for you.

      *We do not recommend this game to people with clown phobia, spider phobia, or panic attacks.*

      **!!!**Note : This game is an early-access game, we are upgrading new features every day, new beasts, new improvements, as an example online 1vs1 fall on the list, so stay on connect and follow Halloween : Horror Well on Google Play.**!!!**

    • By INFRA
      SCAN. DRILL. SURVIVE.   ISOLATED Release in May 1st 2018   https://store.steampowered.com/app/805950/Isolated/   A game by Jérémie Bertrand Music & Sound Design by Pierrick Querolle *** Our solar system has been invaded by strangers. For the purpose of a possible negotiation, a team of astronauts is sent to the moon. Alas, they are shot before even arriving on the scene. Only one astronaut survives the crash and his only goal will be to go home...   GAMEPLAY   Shoot enemy ships to avoid being invaded. Be precise in your movements, because it's better to lose a bit of life at the top than to lose it all at the bottom. Take out your drill to destroy the stones in your path. Validate your identity to cross the different laboratories. Reach the flag before losing your three lives.   And all that... at the same time! Will you be able to go home? If the answer is yes, how long will it take?
    • By BigJiggly
      Hello! So, I've been the leader of BJP for a while now. I'm a bit bored of taking the role I always take, leader. I was hoping someone out there is looking to forge a team maybe and needs a programmer. 
      I have experience mainly in the Unity engine(C# intermediate) and I have a very small amount of knowledge on Shaders, as well as experience on developing games(usually end up stuck in dev hell) and leading experience from my last team which at one point reached 11 people. I personally love the Unity engine and prefer to use it as it's the development environment I'm comfortable with. 
      I have used Unity for over a year and a few months, I'd consider myself an intermediate at the Engine, but to this day Unity still surprises me. 
      I live in the United Kingdom, I find it a bit strange to work with other programmers as the ones I've worked with tend to leave their code heavily unoptimised and I'm a on the go optimise kind of guy, I also like to get things done quickly.
      If you're a new team and need a programmer that has high levels of ambition and strives to maintain the motivation throughout the team, then I'm your guy. I don't care if you're just beginning because I'm all for helping people learn!
      To finish this off: I like to get things done and I like to get them done right the first time, if I fail I will do it again and again, etc, until I loose all motivation. So if you're a modeller or an artist, please don't leave me to do all the modelling/art as well as the programming and sound. I do have experience in all those areas but my main power is in programming and I'd prefer to keep it that way.
      [If this was posted in the wrong forum, sorry, I don't really know the layout of this website yet]
    • By Alexia
      Hi all,
      A small team are currently undertaking a fairly large game project involving multi-playing, taming and other complex game mechanisms.
      We are looking for someone who is experienced in programming a wide range of mechanisms, more information is on our discord server. It is also a learning experience and we wouldn't expect you to know how to do everything we wanted, but just ask that you would be willing to learn how to.
      If you are interested in joining the (rather long term project) just message me and i'll add you on discord.
      Thanks for your time,
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Slow rotate from point A to point B?

This topic is 421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all.

Inside Unity engine - what is the best way to rotate camera (slow) from point A to point B....A and B are Vec3 points in world coordinates?

I want to create empty game object tempObj , and Lerp it position from point A to point B and call cameraTransform.LookAt(tempObj ) in update.



Edited by zahidulinmarat

Share this post

Link to post
Share on other sites

You can use Vector3.Slerp to calculate the intermediate look direction of the camera. Just remember that the vector parameters are directions rather than points in space. When you have the intermediate direction you can use Quaternion.SetLookRotation to calculate the rotation of the camera transform.

Alternatively you can add an empty GameObject to the scene that you lerp between the two world positions, and then simply call Transform.LookAt, passing in the object as the target. Do note that this does not necessarily give you a constant rotation speed of the camera transform.

Share this post

Link to post
Share on other sites

Not tested coroutine, but there is no reason for it not to work.

public IEnumerator RotateTowards(Transform transObj, Transform lookAt, float duration)
                //Get current rotation
		Quaternion startRot = transObj.rotation;

                //Make a temporary gameObj with wanted rotation
		GameObject temp = new GameObject();
		Transform tempTrans = temp.transform;
		tempTrans.position = transObj.position;
		tempTrans.rotation = transObj.rotation;
		Quaternion endRot = tempTrans.rotation;

                //Lerp with wanted duration
		float timeElapsed = 0f;
		while (timeElapsed < duration)
			timeElapsed += Time.deltaTime;
			transObj.rotation = Quaternion.Lerp(startRot, endRot, timeElapsed / duration);
			yield return new WaitForEndOfFrame();
                //Destroy crunches

Share this post

Link to post
Share on other sites

I've never tried coding this, but this sounds like a job for quaternion SLERP. I've not found a way to interpolate matrices without decomposing them, which is quite a few CPU cycles. I'm generally not a huge fan of quaternions, but I believe interpolation is where they really shine and outperform any other option. I believe interpolation is why they have their place in the game industry.

Most people don't understand quaternions at all. I could tell you about the years I was on a quest to understand them and how little I still know of them. But they are not at all difficult to understand as they are used in this problem. First, understand that game quaternions are a special case of quaternions known as unit quaternions. They are a subset of real quaternions. Unit quaternions are actually not that difficult to understand even though quaternions are hyper dimensional complex (a combination of imaginary and real) numbers.


You can think of unit quaternions as 3 dimensional arrows that point in a specific direction, much like vectors. The difference is that quaternions have a specific rotation around themselves, which vectors do not. For this reason, they are more like orientation matrices than vectors. You load them up much like a matrix with an orientation. Quaternions here are very similar to a 3 by 3 matrix. A 4 by 4 matrix can store position and orientation. A 3 by 3 matrix only stores orientation. Similarly, a quaternion only stores orientation and can't store position. So, you have to store the position and any scale value separately.


Don't try and understand their math. Besides the world of imaginary numbers scrambling your brain and short circuiting it, it won't really help. Think of them as a black box that you load with an orientation. Load it, do all your rotations or whatever needs to be done, and then read the orientation out of it when you are done. (More accurately, you're probably going to convert it to a 4 by 4 matrix and invert it for a View matrix.) In other words, let the quaternions know what the orientation is, you as the programmer don't need to know what's inside the quaternion at any point.


As for LERP, that stands for Linear inERPolation. That will work, but SLERP (Spherical Linear intERPolation) is a better choice for this problem I believe. I believe LERP will un-naturally accelerate the rotation points you are interpolating between the two rotations. You can google the difference between LERP and SLERP for more detail on that, but I think SLERP will give you a smoother and more regular rotation in this case.


The way Unity does things will probably confuse the math here a bit. You would probably want to either understand that the View matrix (camera) works backwards for things like rotations and translations and/or Invert it to make it work like an object's world-matrix (position and orientation). Then you do your rotation after the inversion and invert it back to once again turn it into a View matrix. In the case of Unity, however, you probably have an object rotation function that will accept a quaternion as input. Don't be surprised if you have to rotate the camera in the opposite direction you would a standard game object.


Dakila's code looks like it would probably work, but look into SLERP as a replacement for LERP. Not sure what the options for that in Unity are.

Edited by BBeck

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement