Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by saucer78 · Aug 30, 2014 at 06:46 PM · camera followmouse look

A good third person follow camera?

I'm wanting to create an "on-rails" experience for the Oculus Rift. The rider is towed behind a flying dragon, much like Santa in his sleigh, behind his reindeer.

I have "attached" a camera to the dragon, and am successfully following it on its flight path, but am having trouble "loosening" the path of the camera so it is not so rigidly following the dragon. I am also having trouble enabling a successful mouse look (that will become the input for the Oculus Rift.) I have played with all of the camera and Mouse Look script included with the Unity Standard Assets, but have no idea how to code.

Can someone set me on the right path to solving these two problems? Should I look for custom scripts or are there certain assets in the store that pertain to exactly what I'm trying to achieve?

Thanks so much!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by TheShadyColombian · Aug 30, 2014 at 07:03 PM

i'm not sure i can post this as i remember seeing it and copying it from somewhere but here is the script i attached to my camera:

 //SmoothLookAt.cs
 //Written by Jake Bayer
 //Written and uploaded November 18, 2012
 //This is a modified C# version of the SmoothLookAt JS script.  Use it the same way as the Javascript version.
 
 using UnityEngine;
 using System.Collections;
 
 ///<summary>
 ///Looks at a target
 ///</summary>
 [AddComponentMenu("Camera-Control/Smooth Look At CS")]
 public class SmoothCamera : MonoBehaviour {
     public Transform target;        //an Object to lock on to
     public float damping = 6.0f;    //to control the rotation 
     public bool smooth = true;
     public float minDistance = 10.0f;    //How far the target is from the camera
     public string property = "";
     
     private Color color;
     private float alpha = 1.0f;
     private Transform _myTransform;
     
     void Awake() {
         _myTransform = transform;
     }
     
     // Use this for initialization
     void Start () {
         //        if(renderer.material.HasProperty(property)) {
         //            color = renderer.material.GetColor(property);
         //        }
         //        else {
         //            property = "";
         //        }
         //        if(rigidbody) {
         //            rigidbody.freezeRotation = true;
         //        }
         
     }
     
     // Update is called once per frame
     void Update () {
         
     }
     void LateUpdate() {
         if(target) {
             if(smooth) {
                 
                 //Look at and dampen the rotation
                 Quaternion rotation = Quaternion.LookRotation(target.position - _myTransform.position);
                 _myTransform.rotation = Quaternion.Slerp(_myTransform.rotation, rotation, Time.deltaTime * damping);
             }
             else { //Just look at
                 _myTransform.rotation = Quaternion.FromToRotation(-Vector3.forward, (new Vector3(target.position.x, target.position.y, target.position.z) - _myTransform.position).normalized);
                 
                 float distance = Vector3.Distance(target.position, _myTransform.position);
                 
                 if(distance < minDistance) {
                     alpha = Mathf.Lerp(alpha, 0.0f, Time.deltaTime * 2.0f);
                 }
                 else {
                     alpha = Mathf.Lerp(alpha, 1.0f, Time.deltaTime * 2.0f);
                     
                 }
                 //                if(!string.IsNullOrEmpty(property)) {
                 //                    color.a = Mathf.Clamp(alpha, 0.0f, 1.0f);
                 
                 //                    renderer.material.SetColor(property, color);
                 
                 //                }
             }
         }
     }
 }



oh wait, the credentials are on the script rightfully so... i did not create this script, Jake Bayer did and i do not own it in any way. found the link! (Click me!)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Eric-Eidel · Apr 21, 2016 at 04:49 AM

Hey guys, I know this is a bit old but this is the first result on Google for me and I spent quite the time to find the answer I wanted. Check out this page: https://ruhrnuklear.de/fcc/ for a great implementation and a demo scene on a WOW-like camera and controller.

This is what I was after and it provided me a great starting point! The project is a bit dated, but once you update it for 5.3 it works out of the box! Just wanted to place this here since this is the top google result, in case someone else is looking for a wow-like camera (yes, cliche, but it's the best MMO camera controls out there imho).

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image augzoo · Mar 14, 2017 at 12:04 PM 0
Share

Link is broken.

avatar image
0

Answer by dullmist861357 · Mar 16, 2017 at 08:24 PM

add a simple mouse rotator and set the Y axis to a low number such as ten. If you set the Y to say 1 and the x to say zero (y is left and right and x is up and down) you will have small movements, but can't look around too much. Should stop it being all sharp. Should work. @saucer78

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Explaining A Mouse Look Script 1 Answer

Controls Like the Mouse Look. Just without using Mouse 1 Answer

camera follow problem 4 Answers

How do I disable 2D camera follow when my player collides with a trigger object? 0 Answers

How to set the follow distance to a target object when using the “Multipurpose Camera Rig”? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges